]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Round up results to the next multiple of 4.
authorKarsten Loesing <karsten.loesing@gmx.net>
Tue, 14 Jul 2009 00:04:20 +0000 (02:04 +0200)
committerKarsten Loesing <karsten.loesing@gmx.net>
Wed, 15 Jul 2009 14:12:45 +0000 (16:12 +0200)
src/or/geoip.c

index 1430f34ae519f69b35b73415244973b46581cf19..819c9f01829060e3261abc1a706846ed92cc834f 100644 (file)
@@ -730,6 +730,13 @@ geoip_get_dirreqdl_history(geoip_client_action_t action,
       MAP_DEL_CURRENT(key);
     }
   } STRMAP_FOREACH_END;
+#define DIR_REQ_GRANULARITY 4
+  complete = round_uint32_to_next_multiple_of(complete,
+                                              DIR_REQ_GRANULARITY);
+  timeouts = round_uint32_to_next_multiple_of(timeouts,
+                                              DIR_REQ_GRANULARITY);
+  running = round_uint32_to_next_multiple_of(running,
+                                             DIR_REQ_GRANULARITY);
   result = tor_malloc_zero(bufsize);
   written = tor_snprintf(result, bufsize, "complete=%u,timeout=%u,"
                          "running=%u", complete, timeouts, running);