From: Nick Mathewson Date: Tue, 14 Jul 2009 16:18:27 +0000 (-0400) Subject: Merge commit 'karsten/geoipstats-download-resp-master' X-Git-Tag: tor-0.2.2.1-alpha~54 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31b72732c66f86e686e7420c83480661ed8d914b;p=thirdparty%2Ftor.git Merge commit 'karsten/geoipstats-download-resp-master' Conflicts: src/or/geoip.c --- 31b72732c66f86e686e7420c83480661ed8d914b diff --cc src/or/geoip.c index 6cfc1392bb,a182e213a5..0aa5fd873b --- a/src/or/geoip.c +++ b/src/or/geoip.c @@@ -711,7 -675,34 +749,34 @@@ dump_geoip_stats(void since, data_v3 ? data_v3 : "", data_v2 ? data_v2 : "") < 0) goto done; + #define RESPONSE_GRANULARITY 8 + for (i = 0; i < GEOIP_NS_RESPONSE_NUM; i++) { + ns_v2_responses[i] = round_uint32_to_next_multiple_of( + ns_v2_responses[i], RESPONSE_GRANULARITY); + ns_v3_responses[i] = round_uint32_to_next_multiple_of( + ns_v3_responses[i], RESPONSE_GRANULARITY); + } + #undef RESPONSE_GRANULARITY + if (fprintf(out, "n-ns-resp ok=%u,not-enough-sigs=%u,unavailable=%u," + "not-found=%u,not-modified=%u,busy=%u\n", + ns_v3_responses[GEOIP_SUCCESS], + ns_v3_responses[GEOIP_REJECT_NOT_ENOUGH_SIGS], + ns_v3_responses[GEOIP_REJECT_UNAVAILABLE], + ns_v3_responses[GEOIP_REJECT_NOT_FOUND], + ns_v3_responses[GEOIP_REJECT_NOT_MODIFIED], + ns_v3_responses[GEOIP_REJECT_BUSY]) < 0) + goto done; + if (fprintf(out, "n-v2-ns-resp ok=%u,unavailable=%u," + "not-found=%u,not-modified=%u,busy=%u\n", + ns_v2_responses[GEOIP_SUCCESS], + ns_v2_responses[GEOIP_REJECT_UNAVAILABLE], + ns_v2_responses[GEOIP_REJECT_NOT_FOUND], + ns_v2_responses[GEOIP_REJECT_NOT_MODIFIED], + ns_v2_responses[GEOIP_REJECT_BUSY]) < 0) + goto done; + memset(ns_v2_responses, 0, sizeof(ns_v2_responses)); + memset(ns_v3_responses, 0, sizeof(ns_v3_responses)); - if (!router_get_my_share_of_directory_requests(&v2_share, &v3_share)) { + if (!geoip_get_mean_shares(now, &v2_share, &v3_share)) { if (fprintf(out, "v2-ns-share %0.2lf%%\n", v2_share*100) < 0) goto done; if (fprintf(out, "v3-ns-share %0.2lf%%\n", v3_share*100) < 0)