aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-06-24 23:09:21 +0000
committerRoger Dingledine <arma@torproject.org>2003-06-24 23:09:21 +0000
commitdfdc93eccb2a98c40c886e984a8e3c9160bfdfea (patch)
tree1c8b6eb69099fc1a4b27146be7e2d70370a31763
parent23b1586c2640fc1163ace1f14793c25f71b947c7 (diff)
downloadtor-dfdc93eccb2a98c40c886e984a8e3c9160bfdfea.tar
tor-dfdc93eccb2a98c40c886e984a8e3c9160bfdfea.tar.gz
improve robustness: connection_get_by_* ignores conns marked for close
svn:r352
-rw-r--r--src/or/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/main.c b/src/or/main.c
index bc1e65e4c..a9c3064d2 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -119,7 +119,7 @@ connection_t *connection_twin_get_by_addr_port(uint32_t addr, uint16_t port) {
/* first check if it's there exactly */
conn = connection_exact_get_by_addr_port(addr,port);
- if(conn && connection_state_is_open(conn)) {
+ if(conn && connection_state_is_open(conn) && !conn->marked_for_close) {
log(LOG_INFO,"connection_twin_get_by_addr_port(): Found exact match.");
return conn;
}
@@ -150,7 +150,7 @@ connection_t *connection_exact_get_by_addr_port(uint32_t addr, uint16_t port) {
for(i=0;i<nfds;i++) {
conn = connection_array[i];
assert(conn);
- if(conn->addr == addr && conn->port == port)
+ if(conn->addr == addr && conn->port == port && !conn->marked_for_close)
return conn;
}
return NULL;
@@ -162,7 +162,7 @@ connection_t *connection_get_by_type(int type) {
for(i=0;i<nfds;i++) {
conn = connection_array[i];
- if(conn->type == type)
+ if(conn->type == type && !conn->marked_for_close)
return conn;
}
return NULL;
@@ -174,7 +174,7 @@ connection_t *connection_get_by_type_state(int type, int state) {
for(i=0;i<nfds;i++) {
conn = connection_array[i];
- if(conn->type == type && conn->state == state)
+ if(conn->type == type && conn->state == state && !conn->marked_for_close)
return conn;
}
return NULL;