diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-05-19 08:17:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-19 08:17:02 -0400 |
commit | 9f217c83b0d91508af0d63f04216fa78cdbfbe1b (patch) | |
tree | ec66be6c1139d45ebc2ad81d09156445ceca4b3c /src/or/circuituse.c | |
parent | 3f49474349538be499ab485c697c147c8829fa0d (diff) | |
parent | f698b509d8efdc055cfc05c6feaf0aecee41b9d0 (diff) | |
download | tor-9f217c83b0d91508af0d63f04216fa78cdbfbe1b.tar.gz tor-9f217c83b0d91508af0d63f04216fa78cdbfbe1b.zip |
Merge branch 'bug18809_028_squashed' into 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 e43b24ca7d..2c724dee05 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -2360,6 +2360,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; |