diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-06-10 19:51:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-06-10 19:51:48 +0000 |
commit | 16b62a01e4d640212757e0f532bf6f87f0672a42 (patch) | |
tree | fd1eb302a695938cc2e48f1e2c26fba9e3c0a0ea /src | |
parent | e3d1ad67f669a8a052a837f6a3dc632e03cae261 (diff) | |
download | tor-16b62a01e4d640212757e0f532bf6f87f0672a42.tar tor-16b62a01e4d640212757e0f532bf6f87f0672a42.tar.gz |
a couple more geoip bugfixes
svn:r15105
Diffstat (limited to 'src')
-rw-r--r-- | src/or/geoip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c index fb9ae2593..3d4aac974 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -291,6 +291,10 @@ geoip_note_client_seen(geoip_client_action_t action, while (current_request_period_starts + REQUEST_HIST_PERIOD < now) { if (!geoip_countries) geoip_countries = smartlist_create(); + if (!current_request_period_starts) { + current_request_period_starts = now; + break; + } SMARTLIST_FOREACH(geoip_countries, geoip_country_t *, c, { memmove(&c->n_v2_ns_requests[0], &c->n_v2_ns_requests[1], sizeof(uint32_t)*(REQUEST_HIST_LEN-1)); @@ -300,9 +304,9 @@ geoip_note_client_seen(geoip_client_action_t action, c->n_v3_ns_requests[REQUEST_HIST_LEN-1] = 0; }); current_request_period_starts += REQUEST_HIST_PERIOD; - if (n_old_request_periods < REQUEST_HIST_PERIOD-1) + if (n_old_request_periods < REQUEST_HIST_LEN-1) ++n_old_request_periods; - } + } /* We use the low 3 bits of the time to encode the action. Since we're * potentially remembering tons of clients, we don't want to make |