diff options
author | Roger Dingledine <arma@torproject.org> | 2009-01-28 06:50:36 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2009-01-28 06:50:36 +0000 |
commit | edff6063172ad4fb6a835b2c218856aa93efe8da (patch) | |
tree | 41396b6f0e70c20df8fc1902d3dca20fb07b49c9 /src/or/control.c | |
parent | 31d60992c6a71a2aee35bf43267f606755bcac6c (diff) | |
download | tor-edff6063172ad4fb6a835b2c218856aa93efe8da.tar.gz tor-edff6063172ad4fb6a835b2c218856aa93efe8da.zip |
patch from matt to implement 'getinfo status/clients-seen'
svn:r18287
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c index 9c9fce0992..9f80d38cf6 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1837,6 +1837,25 @@ getinfo_helper_events(control_connection_t *control_conn, log_warn(LD_GENERAL, "%s is deprecated; it no longer gives useful " "information", question); } + } else if (!strcmp(question, "status/clients-seen")) { + char geoip_start[ISO_TIME_LEN+1]; + char *geoip_summary; + smartlist_t *sl; + + geoip_summary = extrainfo_get_client_geoip_summary(time(NULL)); + if (!geoip_summary) + return -1; + format_iso_time(geoip_start, geoip_get_history_start()); + + sl = smartlist_create(); + smartlist_add(sl, (char *)"TimeStarted=\""); + smartlist_add(sl, geoip_start); + smartlist_add(sl, (char *)"\" CountrySummary="); + smartlist_add(sl, geoip_summary); + *answer = smartlist_join_strings(sl, "", 0, 0); + + tor_free(geoip_summary); + smartlist_free(sl); } else { return 0; } @@ -1937,6 +1956,8 @@ static const getinfo_item_t getinfo_items[] = { "circuits."), DOC("status/bootstrap-phase", "The last bootstrap phase status event that Tor sent."), + DOC("status/clients-seen", + "Breakdown of client countries seen by a bridge."), DOC("status/version/recommended", "List of currently recommended versions."), DOC("status/version/current", "Status of the current version."), DOC("status/version/num-versioning", "Number of versioning authorities."), @@ -3931,7 +3952,7 @@ void control_event_clients_seen(const char *timestarted, const char *countries) { send_control_event(EVENT_CLIENTS_SEEN, 0, - "650 CLIENTS_SEEN Timestarted=\"%s\" CountrySummary=%s\r\n", + "650 CLIENTS_SEEN TimeStarted=\"%s\" CountrySummary=%s\r\n", timestarted, countries); } |