aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-11-18 10:17:52 +0000
committerRoger Dingledine <arma@torproject.org>2003-11-18 10:17:52 +0000
commitc00953d2a119b372c46fee27a9655ea00dabb577 (patch)
treed926be0e05fbb7a82f3ad2e4acf61af83e541ae3 /src/or/connection.c
parentf0cccc567ecfd318305c4b6bab05091a50532e2a (diff)
downloadtor-c00953d2a119b372c46fee27a9655ea00dabb577.tar
tor-c00953d2a119b372c46fee27a9655ea00dabb577.tar.gz
make more sure we can't end up with two connections to the same OR
fix leaked pk in connection_tls_finish_handshake svn:r839
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index e4685b787..022e4d67a 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -551,7 +551,6 @@ connection_t *connection_twin_get_by_addr_port(uint32_t addr, uint16_t port) {
conn = carray[i];
assert(conn);
if(connection_state_is_open(conn) &&
- !conn->marked_for_close &&
!crypto_pk_cmp_keys(conn->onion_pkey, router->onion_pkey)) {
log(LOG_INFO,"connection_twin_get_by_addr_port(): Found twin (%s).",conn->address);
return conn;
@@ -629,6 +628,9 @@ int connection_is_listener(connection_t *conn) {
int connection_state_is_open(connection_t *conn) {
assert(conn);
+ if(conn->marked_for_close)
+ return 0;
+
if((conn->type == CONN_TYPE_OR && conn->state == OR_CONN_STATE_OPEN) ||
(conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN) ||
(conn->type == CONN_TYPE_EXIT && conn->state == EXIT_CONN_STATE_OPEN))