diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-05-29 02:29:35 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-05-29 02:29:35 +0000 |
commit | ac330d9ba72c2379372682216b329f384dbe30fe (patch) | |
tree | 35a3f7992afe4d4007d3aca45b2819bb70de2dbc /src/or/directory.c | |
parent | 6e68c23de74e613fb06cb4412c854845e46bed43 (diff) | |
download | tor-ac330d9ba72c2379372682216b329f384dbe30fe.tar.gz tor-ac330d9ba72c2379372682216b329f384dbe30fe.zip |
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/directory.c')
-rw-r--r-- | src/or/directory.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index e753df85eb..bc3cac13ee 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2484,6 +2484,26 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, goto done; } +#ifdef ENABLE_GEOIP_STATS + { + geoip_client_action_t act = + is_v3 ? GEOIP_CLIENT_NETWORKSTATUS : GEOIP_CLIENT_NETWORKSTATUS_V2; + uint32_t addr = conn->_base.addr; + + if (conn->_base.linked_conn) { + connection_t *c = conn->_base.linked_conn; + if (c->type == CONN_TYPE_EXIT) { + circuit_t *circ = TO_EDGE_CONN(c)->on_circuit; + if (! CIRCUIT_IS_ORIGIN(circ)) { + or_connection_t *orconn = TO_OR_CIRCUIT(circ)->p_conn; + addr = orconn->_base.addr; + } + } + } + geoip_note_client_seen(act, addr, time(NULL)); + } +#endif + // note_request(request_type,dlen); (void) request_type; write_http_response_header(conn, -1, compressed, |