diff options
author | erdgeist <> | 2007-03-10 15:39:19 +0000 |
---|---|---|
committer | erdgeist <> | 2007-03-10 15:39:19 +0000 |
commit | e75c3e25cd1d33eecd8303f06365ae921141dfa6 (patch) | |
tree | f5a1f35b4abf335f15f3c7b809e4d492a0852e42 | |
parent | 5b55394cdc4f3ab1daa784291f8b66b5c0c419de (diff) |
make full scrapes a bit faster, increase checkback time for udp
-rw-r--r-- | opentracker.c | 3 | ||||
-rw-r--r-- | trackerlogic.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/opentracker.c b/opentracker.c index 656764d..b4386c6 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -608,7 +608,8 @@ static void handle_udp4( int64 serversocket ) { | |||
608 | /* Create fake packet to satisfy parser on the other end */ | 608 | /* Create fake packet to satisfy parser on the other end */ |
609 | outpacket[0] = htonl( 1 ); | 609 | outpacket[0] = htonl( 1 ); |
610 | outpacket[1] = inpacket[12/4]; | 610 | outpacket[1] = inpacket[12/4]; |
611 | outpacket[2] = outpacket[3] = outpacket[4] = 0; | 611 | outpacket[2] = OT_CLIENT_REQUEST_INTERVAL_RANDOM; |
612 | outpacket[3] = outpacket[4] = 0; | ||
612 | socket_send4( serversocket, static_outbuf, 20, remoteip, port ); | 613 | socket_send4( serversocket, static_outbuf, 20, remoteip, port ); |
613 | } else { | 614 | } else { |
614 | torrent = add_peer_to_torrent( hash, &peer ); | 615 | torrent = add_peer_to_torrent( hash, &peer ); |
diff --git a/trackerlogic.c b/trackerlogic.c index c18f13a..bc9010e 100644 --- a/trackerlogic.c +++ b/trackerlogic.c | |||
@@ -347,7 +347,6 @@ size_t return_fullscrape_for_tracker( char **reply ) { | |||
347 | size_t torrent_count = 0, j; | 347 | size_t torrent_count = 0, j; |
348 | int i, k; | 348 | int i, k; |
349 | char *r; | 349 | char *r; |
350 | time_t time_now = NOW; | ||
351 | 350 | ||
352 | for( i=0; i<256; ++i ) { | 351 | for( i=0; i<256; ++i ) { |
353 | ot_vector *torrents_list = &all_torrents[i]; | 352 | ot_vector *torrents_list = &all_torrents[i]; |
@@ -363,12 +362,11 @@ size_t return_fullscrape_for_tracker( char **reply ) { | |||
363 | ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; | 362 | ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; |
364 | ot_hash *hash =&( ((ot_torrent*)(torrents_list->data))[j] ).hash; | 363 | ot_hash *hash =&( ((ot_torrent*)(torrents_list->data))[j] ).hash; |
365 | size_t peers = 0, seeds = 0; | 364 | size_t peers = 0, seeds = 0; |
366 | clean_peerlist( time_now, peer_list ); | ||
367 | for( k=0; k<OT_POOLS_COUNT; ++k ) { | 365 | for( k=0; k<OT_POOLS_COUNT; ++k ) { |
368 | peers += peer_list->peers[k].size; | 366 | peers += peer_list->peers[k].size; |
369 | seeds += peer_list->seed_count[k]; | 367 | seeds += peer_list->seed_count[k]; |
370 | } | 368 | } |
371 | memmove( r, "20:", 3 ); r+=3; | 369 | *r++='2'; *r++='0'; *r++=':'; |
372 | memmove( r, hash, 20 ); r+=20; | 370 | memmove( r, hash, 20 ); r+=20; |
373 | r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds ); | 371 | r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds ); |
374 | } | 372 | } |