diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2013-01-18 19:37:16 -0800 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2013-01-18 19:46:21 -0800 |
commit | e13e30221ef6715cafa93bbffc156583c8b58ecf (patch) | |
tree | 09b12822e6f3b3dafbe610a35617e8c8c2f4777c /src/or/circuituse.c | |
parent | ee421e68d5231e3962b45f8bbfc6505c8e6f3315 (diff) | |
download | tor-e13e30221ef6715cafa93bbffc156583c8b58ecf.tar.gz tor-e13e30221ef6715cafa93bbffc156583c8b58ecf.zip |
Implement Path use bias accounting.
Path use bias measures how often we can actually succeed using the circuits we
actually try to use. It is a subset of path bias accounting, but it is
computed as a separate statistic because the rate of client circuit use may
vary depending on use case.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 83734c9d6d..d0b1b49465 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -2037,6 +2037,8 @@ connection_ap_handshake_attach_chosen_circuit(entry_connection_t *conn, if (!circ->base_.timestamp_dirty) circ->base_.timestamp_dirty = time(NULL); + pathbias_count_use_attempt(circ); + link_apconn_to_circ(conn, circ, cpath); tor_assert(conn->socks_request); if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) { @@ -2163,6 +2165,11 @@ connection_ap_handshake_attach_circuit(entry_connection_t *conn) * feasibility, at this point. */ rendcirc->base_.timestamp_dirty = time(NULL); + + /* We've also attempted to use them. If they fail, we need to + * probe them for path bias */ + pathbias_count_use_attempt(rendcirc); + link_apconn_to_circ(conn, rendcirc, NULL); if (connection_ap_handshake_send_begin(conn) < 0) return 0; /* already marked, let them fade away */ @@ -2214,6 +2221,10 @@ connection_ap_handshake_attach_circuit(entry_connection_t *conn) case 0: /* success */ rendcirc->base_.timestamp_dirty = time(NULL); introcirc->base_.timestamp_dirty = time(NULL); + + pathbias_count_use_attempt(introcirc); + pathbias_count_use_attempt(rendcirc); + assert_circuit_ok(TO_CIRCUIT(rendcirc)); assert_circuit_ok(TO_CIRCUIT(introcirc)); return 0; |