diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-05-19 08:25:12 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-19 08:25:12 -0400 |
commit | d718c717a67051cb1da2a1f80c70401d0d10b374 (patch) | |
tree | 8a5fdc8466bc79e54d6b0f07d0e98bcdbf946119 /src/or/circuituse.c | |
parent | 159ea7a88f31aee2f84cf964c0d0000a5bd98970 (diff) | |
parent | 9f217c83b0d91508af0d63f04216fa78cdbfbe1b (diff) | |
download | tor-d718c717a67051cb1da2a1f80c70401d0d10b374.tar.gz tor-d718c717a67051cb1da2a1f80c70401d0d10b374.zip |
Merge branch 'maint-0.2.8'
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 539056f280..0d7e03be59 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -2361,6 +2361,25 @@ connection_ap_handshake_attach_circuit(entry_connection_t *conn) /* we're a general conn */ origin_circuit_t *circ=NULL; + /* Are we linked to a dir conn that aims to fetch a consensus? + * We check here because this conn might no longer be needed. */ + if (base_conn->linked_conn && + base_conn->linked_conn->type == CONN_TYPE_DIR && + base_conn->linked_conn->purpose == DIR_PURPOSE_FETCH_CONSENSUS) { + + /* Yes we are. Is there a consensus fetch farther along than us? */ + if (networkstatus_consensus_is_already_downloading( + TO_DIR_CONN(base_conn->linked_conn)->requested_resource)) { + /* We're doing the "multiple consensus fetch attempts" game from + * proposal 210, and we're late to the party. Just close this conn. + * The circuit and TLS conn that we made will time out after a while + * if nothing else wants to use them. */ + log_info(LD_DIR, "Closing extra consensus fetch (to %s) since one " + "is already downloading.", base_conn->linked_conn->address); + return -1; + } + } + if (conn->chosen_exit_name) { const node_t *node = node_get_by_nickname(conn->chosen_exit_name, 1); int opt = conn->chosen_exit_optional; |