Browse Source

some more small fixes

svn:r1152
Roger Dingledine 21 years ago
parent
commit
e59f19ca03
3 changed files with 8 additions and 4 deletions
  1. 1 0
      src/or/connection.c
  2. 3 1
      src/or/connection_edge.c
  3. 4 3
      src/or/main.c

+ 1 - 0
src/or/connection.c

@@ -559,6 +559,7 @@ int connection_handle_write(connection_t *conn) {
       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 */

+ 3 - 1
src/or/connection_edge.c

@@ -305,7 +305,9 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
       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. */

+ 4 - 3
src/or/main.c

@@ -158,6 +158,9 @@ void connection_start_writing(connection_t *conn) {
 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 @@ static void conn_read(int i) {
        !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 @@ static void conn_write(int i) {
   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);
     }