aboutsummaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-05-29 02:29:35 +0000
committerNick Mathewson <nickm@torproject.org>2008-05-29 02:29:35 +0000
commitac330d9ba72c2379372682216b329f384dbe30fe (patch)
tree35a3f7992afe4d4007d3aca45b2819bb70de2dbc /src/or/test.c
parent6e68c23de74e613fb06cb4412c854845e46bed43 (diff)
downloadtor-ac330d9ba72c2379372682216b329f384dbe30fe.tar
tor-ac330d9ba72c2379372682216b329f384dbe30fe.tar.gz
New code to implement proposal for local geoip stats. Only enabled with --enable-geoip-stats passed to configure.
svn:r14802
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 391efec4e..6dcb521ee 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -3908,28 +3908,28 @@ test_geoip(void)
get_options()->BridgeRecordUsageByCountry = 1;
/* Put 9 observations in AB... */
for (i=32; i < 40; ++i)
- geoip_note_client_seen(i, now);
- geoip_note_client_seen(225, now);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, 225, now);
/* and 3 observations in XY, several times. */
for (j=0; j < 10; ++j)
for (i=52; i < 55; ++i)
- geoip_note_client_seen(i, now-3600);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-3600);
/* and 17 observations in ZZ... */
for (i=110; i < 127; ++i)
- geoip_note_client_seen(i, now-7200);
- s = geoip_get_client_history(now+5*24*60*60);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-7200);
+ s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT);
test_assert(s);
test_streq("zz=24,ab=16", s);
tor_free(s);
/* Now clear out all the zz observations. */
geoip_remove_old_clients(now-6000);
- s = geoip_get_client_history(now+5*24*60*60);
+ s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT);
test_assert(! s); /* There are only 12 observations left. Not enough to
build an answer. Add 4 more in XY... */
for (i=55; i < 59; ++i)
- geoip_note_client_seen(i, now-3600);
- s = geoip_get_client_history(now+5*24*60*60);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-3600);
+ s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT);
test_assert(s);
test_streq("ab=16", s);
tor_free(s);