[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] improve robustness: connection_get_by_* ignores conns marke...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home/arma/work/onion/cvs/src/or

Modified Files:
	main.c 
Log Message:
improve robustness: connection_get_by_* ignores conns marked for close


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- main.c	21 Jun 2003 19:03:22 -0000	1.71
+++ main.c	24 Jun 2003 23:09:21 -0000	1.72
@@ -119,7 +119,7 @@
 
   /* 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 @@
   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 @@
 
   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 @@
 
   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;