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

[or-cvs] fix a rare race condition: when we send a cell and then



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

Modified Files:
	main.c 
Log Message:
fix a rare race condition: when we send a cell and then
mark an OR connection expired, we might close it before
finishing a flush if the other side isn't reading.


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -d -r1.193 -r1.194
--- main.c	6 Mar 2004 01:43:37 -0000	1.193
+++ main.c	6 Mar 2004 06:05:00 -0000	1.194
@@ -304,10 +304,9 @@
       /* we're an onion proxy, with no circuits; or our handshake has expired. kill it. */
       log_fn(LOG_INFO,"Expiring connection to %d (%s:%d).",
              i,conn->address, conn->port);
-      connection_mark_for_close(conn,0); /* Suppress end ??? */
-/* XXX there's no concept of 'suppressing end' here, because it's an OR
- * connection, and there's no such thing as an end cell for an OR
- * connection. -RD */
+      /* flush anything waiting, e.g. a destroy for a just-expired circ */
+      conn->hold_open_until_flushed = 1;
+      connection_mark_for_close(conn,0);
     } else {
       /* either a full router, or we've got a circuit. send a padding cell. */
       log_fn(LOG_DEBUG,"Sending keepalive to (%s:%d)",