Browse Source

make full scrapes a bit faster, increase checkback time for udp

dynamic-accesslists
erdgeist 18 years ago
parent
commit
e75c3e25cd
  1. 3
      opentracker.c
  2. 4
      trackerlogic.c

3
opentracker.c

@ -608,7 +608,8 @@ static void handle_udp4( int64 serversocket ) {
/* Create fake packet to satisfy parser on the other end */ /* Create fake packet to satisfy parser on the other end */
outpacket[0] = htonl( 1 ); outpacket[0] = htonl( 1 );
outpacket[1] = inpacket[12/4]; outpacket[1] = inpacket[12/4];
outpacket[2] = outpacket[3] = outpacket[4] = 0; outpacket[2] = OT_CLIENT_REQUEST_INTERVAL_RANDOM;
outpacket[3] = outpacket[4] = 0;
socket_send4( serversocket, static_outbuf, 20, remoteip, port ); socket_send4( serversocket, static_outbuf, 20, remoteip, port );
} else { } else {
torrent = add_peer_to_torrent( hash, &peer ); torrent = add_peer_to_torrent( hash, &peer );

4
trackerlogic.c

@ -347,7 +347,6 @@ size_t return_fullscrape_for_tracker( char **reply ) {
size_t torrent_count = 0, j; size_t torrent_count = 0, j;
int i, k; int i, k;
char *r; char *r;
time_t time_now = NOW;
for( i=0; i<256; ++i ) { for( i=0; i<256; ++i ) {
ot_vector *torrents_list = &all_torrents[i]; ot_vector *torrents_list = &all_torrents[i];
@ -363,12 +362,11 @@ size_t return_fullscrape_for_tracker( char **reply ) {
ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list;
ot_hash *hash =&( ((ot_torrent*)(torrents_list->data))[j] ).hash; ot_hash *hash =&( ((ot_torrent*)(torrents_list->data))[j] ).hash;
size_t peers = 0, seeds = 0; size_t peers = 0, seeds = 0;
clean_peerlist( time_now, peer_list );
for( k=0; k<OT_POOLS_COUNT; ++k ) { for( k=0; k<OT_POOLS_COUNT; ++k ) {
peers += peer_list->peers[k].size; peers += peer_list->peers[k].size;
seeds += peer_list->seed_count[k]; seeds += peer_list->seed_count[k];
} }
memmove( r, "20:", 3 ); r+=3; *r++='2'; *r++='0'; *r++=':';
memmove( r, hash, 20 ); r+=20; memmove( r, hash, 20 ); r+=20;
r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds ); r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds );
} }

Loading…
Cancel
Save