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

[or-cvs] resolve a double-mark-for-close when things die inside conn...



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

Modified Files:
	connection.c 
Log Message:
resolve a double-mark-for-close when things die inside connection_handle_write


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- connection.c	25 Apr 2004 20:37:37 -0000	1.199
+++ connection.c	25 Apr 2004 22:23:54 -0000	1.200
@@ -674,7 +674,7 @@
   return (conn->outbuf_flushlen > 10*CELL_PAYLOAD_SIZE);
 }
 
-/* return -1 if you want to break the conn, else return 0 */
+/* mark and return -1 if you want to break the conn, else return 0 */
 int connection_handle_write(connection_t *conn) {
 
   tor_assert(!connection_is_listener(conn));
@@ -732,8 +732,10 @@
   }
 
   if(!connection_wants_to_flush(conn)) /* it's done flushing */
-    if(connection_finished_flushing(conn) < 0) /* ...and get handled here. */
+    if(connection_finished_flushing(conn) < 0) { /* ...and get handled here. */
+      /* already marked */
       return -1;
+    }
 
   return 0;
 }
@@ -762,7 +764,7 @@
     conn->outbuf_flushlen = MIN_TLS_FLUSHLEN;
     if(connection_handle_write(conn) < 0) {
       log_fn(LOG_WARN,"flushing failed.");
-      connection_mark_for_close(conn,0);
+      return;
     }
   }
   if(len > 0) { /* if there's any left over */