From bb1c5d28056647f12883b83d6a1cea2ad3e6bbab Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Mon, 3 Nov 2008 01:26:38 +0000 Subject: [PATCH] Add stats about when peers renew their announces. --- ot_mutex.h | 1 + ot_stats.c | 15 +++++++++++++++ ot_stats.h | 1 + trackerlogic.c | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/ot_mutex.h b/ot_mutex.h index c05bdfe..e16a097 100644 --- a/ot_mutex.h +++ b/ot_mutex.h @@ -28,6 +28,7 @@ typedef enum { TASK_STATS_VERSION = 0x000a, TASK_STATS_BUSY_NETWORKS = 0x000b, TASK_STATS_VECTOR_DEBUG = 0x000c, + TASK_STATS_RENEW = 0x000d, TASK_STATS = 0x0100, /* Mask */ TASK_STATS_TORRENTS = 0x0101, diff --git a/ot_stats.c b/ot_stats.c index 5d9dab2..5427f1f 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -46,6 +46,7 @@ static unsigned long long ot_full_scrape_count = 0; static unsigned long long ot_full_scrape_request_count = 0; static unsigned long long ot_full_scrape_size = 0; static unsigned long long ot_failed_request_counts[CODE_HTTPERROR_COUNT]; +static unsigned long long ot_renewed[OT_POOLS_COUNT]; static time_t ot_start_time; @@ -492,6 +493,15 @@ static size_t stats_httperrors_txt ( char * reply ) { ot_failed_request_counts[6] ); } +static size_t stats_return_renew_bucket( char * reply ) { + char *r = reply; + int i; + + for( i=0; ipeer_list->base < NOW ) + torrent->peer_list->base = NOW; } #endif @@ -125,6 +127,7 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer WANT_SYNC_PARAM( case 1: default: torrent->peer_list->peer_count--; mutex_bucket_unlock_by_hash( hash ); + stats_issue_event( EVENT_RENEW, 0, i ); return torrent; } } @@ -142,6 +145,7 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer WANT_SYNC_PARAM( if( OT_FLAG( peer_dest ) & PEER_FLAG_COMPLETED ) OT_FLAG( peer ) |= PEER_FLAG_COMPLETED; + stats_issue_event( EVENT_RENEW, 0, base_pool ); memmove( peer_dest, peer, sizeof( ot_peer ) ); }