[or-cvs] some more small fixes

Roger Dingledine arma at seul.org
Sat Feb 28 04:44:51 UTC 2004


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

Modified Files:
	connection.c connection_edge.c main.c 
Log Message:
some more small fixes


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- connection.c	28 Feb 2004 04:11:52 -0000	1.158
+++ connection.c	28 Feb 2004 04:44:48 -0000	1.159
@@ -559,6 +559,7 @@
       connection_mark_for_close(conn, END_STREAM_REASON_MISC);
       return -1;
     }
+    /* conns in CONNECTING state will fall through... */
   }
 
   if(!connection_wants_to_flush(conn)) /* it's done flushing */

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- connection_edge.c	28 Feb 2004 04:25:54 -0000	1.98
+++ connection_edge.c	28 Feb 2004 04:44:48 -0000	1.99
@@ -305,7 +305,9 @@
       conn->done_sending = 1;
       shutdown(conn->s, 1); /* XXX check return; refactor NM */
       if (conn->done_receiving) {
-        connection_mark_for_close(conn, END_STREAM_REASON_DONE);
+        /* We just *got* an end; no reason to send one. */
+        conn->has_sent_end = 1;
+        connection_mark_for_close(conn, 0);
       }
 #else
       /* We just *got* an end; no reason to send one. */

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- main.c	28 Feb 2004 04:34:27 -0000	1.176
+++ main.c	28 Feb 2004 04:44:48 -0000	1.177
@@ -158,6 +158,9 @@
 static void conn_read(int i) {
   connection_t *conn = connection_array[i];
 
+  if (conn->marked_for_close)
+    return;
+
   /* see http://www.greenend.org.uk/rjk/2001/06/poll.html for
    * discussion of POLLIN vs POLLHUP */
   if(!(poll_array[i].revents & (POLLIN|POLLHUP|POLLERR)))
@@ -165,8 +168,6 @@
        !connection_has_pending_tls_data(conn))
       return; /* this conn should not read */
 
-  if (conn->marked_for_close)
-    return;
   log_fn(LOG_DEBUG,"socket %d wants to read.",conn->s);
 
   assert_connection_ok(conn, time(NULL));
@@ -204,7 +205,7 @@
   if (connection_handle_write(conn) < 0) {
     if (!conn->marked_for_close) {
       /* this connection is broken. remove it. */
-      log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
+      log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
              conn_type_to_string[conn->type], conn->s);
       connection_mark_for_close(conn,0);
     }



More information about the tor-commits mailing list