summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-10-16 00:23:14 +0000
committererdgeist <>2007-10-16 00:23:14 +0000
commit28d88e338032975b4b6fc3e0d6fd413b90c39596 (patch)
tree46ea9f1b3ff9ba319fa8452ae3109a9be6f38daf
parent3dc470d67264a372102a6805c9ca242e00c5e0a5 (diff)
Exclude empty torrents from full scrape, also try to shrink full scrape buffer after it is full
-rw-r--r--opentracker.c1
-rw-r--r--trackerlogic.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/opentracker.c b/opentracker.c
index a2fe24e..87e8b6f 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -374,6 +374,7 @@ SCRAPE_WORKAROUND:
374LOG_TO_STDERR( "scrp: %d.%d.%d.%d - FULL SCRAPE\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); 374LOG_TO_STDERR( "scrp: %d.%d.%d.%d - FULL SCRAPE\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] );
375 375
376 if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500; 376 if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500;
377 if( (c = realloc( reply, reply_size ) ) ) reply = c;
377 ot_overall_tcp_successfulannounces++; 378 ot_overall_tcp_successfulannounces++;
378 return sendmallocdata( s, reply, reply_size ); 379 return sendmallocdata( s, reply, reply_size );
379 } 380 }
diff --git a/trackerlogic.c b/trackerlogic.c
index 239efb8..37b3c4d 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -325,9 +325,11 @@ size_t return_fullscrape_for_tracker( char **reply ) {
325 peers += peer_list->peers[k].size; 325 peers += peer_list->peers[k].size;
326 seeds += peer_list->seed_count[k]; 326 seeds += peer_list->seed_count[k];
327 } 327 }
328 *r++='2'; *r++='0'; *r++=':'; 328 if( peers ) {
329 memmove( r, hash, 20 ); r+=20; 329 *r++='2'; *r++='0'; *r++=':';
330 r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds ); 330 memmove( r, hash, 20 ); r+=20;
331 r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", seeds, peer_list->downloaded, peers-seeds );
332 }
331 } 333 }
332 } 334 }
333 335