From 4c4303a15614404535d3be065d213ac8a992b530 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 30 Aug 2009 17:57:54 +0000 Subject: Temporary feature: log amount of numwants. See if we can save traffic if we reduce max numwant to something less than 200 --- ot_http.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ot_http.c') diff --git a/ot_http.c b/ot_http.c index f116c1f..6d29e9c 100644 --- a/ot_http.c +++ b/ot_http.c @@ -171,7 +171,11 @@ static const ot_keywords keywords_mode[] = { "busy", TASK_STATS_BUSY_NETWORKS }, { "torr", TASK_STATS_TORRENTS }, { "fscr", TASK_STATS_FULLSCRAPE }, { "s24s", TASK_STATS_SLASH24S }, { "tpbs", TASK_STATS_TPB }, { "herr", TASK_STATS_HTTPERRORS }, { "completed", TASK_STATS_COMPLETED }, { "top10", TASK_STATS_TOP10 }, { "renew", TASK_STATS_RENEW }, { "syncs", TASK_STATS_SYNCS }, { "version", TASK_STATS_VERSION }, - { "everything", TASK_STATS_EVERYTHING }, { "statedump", TASK_FULLSCRAPE_TRACKERSTATE }, { "fulllog", TASK_STATS_FULLLOG }, { NULL, -3 } }; + { "everything", TASK_STATS_EVERYTHING }, { "statedump", TASK_FULLSCRAPE_TRACKERSTATE }, { "fulllog", TASK_STATS_FULLLOG }, +#ifdef WANT_LOG_NUMWANT + { "numwants", TASK_STATS_NUMWANTS}, +#endif + { NULL, -3 } }; static const ot_keywords keywords_format[] = { { "bin", TASK_FULLSCRAPE_TPB_BINARY }, { "ben", TASK_FULLSCRAPE }, { "url", TASK_FULLSCRAPE_TPB_URLENCODED }, { "txt", TASK_FULLSCRAPE_TPB_ASCII }, { NULL, -3 } }; @@ -332,6 +336,10 @@ static ssize_t http_handle_scrape( const int64 sock, struct ot_workstruct *ws, c return ws->reply_size; } +#ifdef WANT_LOG_NUMWANT + unsigned long long numwants[201]; +#endif + static ot_keywords keywords_announce[] = { { "port", 1 }, { "left", 2 }, { "event", 3 }, { "numwant", 4 }, { "compact", 5 }, { "compact6", 5 }, { "info_hash", 6 }, #ifdef WANT_IP_FROM_QUERY_STRING { "ip", 7 }, @@ -479,6 +487,10 @@ static ssize_t http_handle_announce( const int64 sock, struct ot_workstruct *ws, } } +#ifdef WANT_LOG_NUMWANT + numwants[numwant]++; +#endif + /* XXX DEBUG */ stats_issue_event( EVENT_ACCEPT, FLAG_TCP, (uintptr_t)ws->reply ); -- cgit v1.2.3