summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-01-23 15:48:51 +0000
committererdgeist <>2007-01-23 15:48:51 +0000
commit00843757c0a3ec3d3f678096289530c610091772 (patch)
tree6ba9e74038a2a511bf2f882b3cc16daa4c16e006
parentbee4ad4ba0b9c2fccbc2be1a5a9092d5030914b2 (diff)
Count successful announces extra
-rw-r--r--opentracker.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c
index ae0de82..e57cc84 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -30,6 +30,7 @@ unsigned int const OT_CLIENT_TIMEOUT = 30;
30unsigned int const OT_CLIENT_TIMEOUT_CHECKINTERVAL = 5; 30unsigned int const OT_CLIENT_TIMEOUT_CHECKINTERVAL = 5;
31 31
32static unsigned int ot_overall_connections = 0; 32static unsigned int ot_overall_connections = 0;
33static unsigned int ot_overall_successfulannounces = 0;
33static time_t ot_start_time; 34static time_t ot_start_time;
34static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80; 35static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80;
35static const size_t SUCCESS_HTTP_SIZE_OFF = 17; 36static const size_t SUCCESS_HTTP_SIZE_OFF = 17;
@@ -359,6 +360,7 @@ e500:
359 if( ( reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + static_scratch ) ) <= 0 ) 360 if( ( reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + static_scratch ) ) <= 0 )
360 goto e500; 361 goto e500;
361 } 362 }
363 ot_overall_successfulannounces++;
362 break; 364 break;
363 case 11: 365 case 11:
364 if( byte_diff(data,11,"mrtg_scrape")) 366 if( byte_diff(data,11,"mrtg_scrape"))
@@ -367,7 +369,7 @@ e500:
367 time_t seconds_elapsed = time( NULL ) - ot_start_time; 369 time_t seconds_elapsed = time( NULL ) - ot_start_time;
368 reply_size = sprintf( static_scratch + SUCCESS_HTTP_HEADER_LENGTH, 370 reply_size = sprintf( static_scratch + SUCCESS_HTTP_HEADER_LENGTH,
369 "%i\n%i\nUp: %i seconds (%i hours)\nPretuned by german engineers, currently handling %i connections per second.", 371 "%i\n%i\nUp: %i seconds (%i hours)\nPretuned by german engineers, currently handling %i connections per second.",
370 ot_overall_connections, ot_overall_connections, (int)seconds_elapsed, 372 ot_overall_connections, ot_overall_successfulannounces, (int)seconds_elapsed,
371 (int)(seconds_elapsed / 3600), (int)ot_overall_connections / ( (int)seconds_elapsed ? (int)seconds_elapsed : 1 ) ); 373 (int)(seconds_elapsed / 3600), (int)ot_overall_connections / ( (int)seconds_elapsed ? (int)seconds_elapsed : 1 ) );
372 } 374 }
373 break; 375 break;