diff options
author | Karsten Loesing <karsten.loesing@gmx.net> | 2009-07-12 16:33:31 +0200 |
---|---|---|
committer | Karsten Loesing <karsten.loesing@gmx.net> | 2009-07-15 16:12:45 +0200 |
commit | 3c051325758c0aeeeb44054715e16d8b8717948c (patch) | |
tree | a9e595b28ce218f3998ed0d3a10f54fc55eefd4e /src/or/directory.c | |
parent | 72c5a46b43c6d89c773a99240a95301b91b1f269 (diff) | |
download | tor-3c051325758c0aeeeb44054715e16d8b8717948c.tar.gz tor-3c051325758c0aeeeb44054715e16d8b8717948c.zip |
Directories now also measure download times of network statuses.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index cf9f5543d7..e5230c2cbd 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2565,9 +2565,18 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, #ifdef ENABLE_GEOIP_STATS { struct in_addr in; - if (tor_inet_aton((TO_CONN(conn))->address, &in)) + if (tor_inet_aton((TO_CONN(conn))->address, &in)) { geoip_note_client_seen(act, ntohl(in.s_addr), time(NULL)); geoip_note_ns_response(act, GEOIP_SUCCESS); + /* Note that a request for a network status has started, so that we + * can measure the download time later on. */ + if (TO_CONN(conn)->request_id) + geoip_start_dirreq(TO_CONN(conn)->request_id, dlen, act, + REQUEST_TUNNELED); + else + geoip_start_dirreq(TO_CONN(conn)->global_identifier, dlen, act, + REQUEST_DIRECT); + } } #endif @@ -3201,6 +3210,17 @@ connection_dir_finished_flushing(dir_connection_t *conn) tor_assert(conn); tor_assert(conn->_base.type == CONN_TYPE_DIR); +#ifdef ENABLE_GEOIP_STATS + /* Note that we have finished writing the directory response. For direct + * connections this means we're done, for tunneled connections its only + * an intermediate step. */ + if (TO_CONN(conn)->request_id) + geoip_change_dirreq_state(TO_CONN(conn)->request_id, REQUEST_TUNNELED, + FLUSHING_DIR_CONN_FINISHED); + else + geoip_change_dirreq_state(TO_CONN(conn)->global_identifier, + REQUEST_DIRECT, FLUSHING_DIR_CONN_FINISHED); +#endif switch (conn->_base.state) { case DIR_CONN_STATE_CLIENT_SENDING: log_debug(LD_DIR,"client finished sending command."); |