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

[or-cvs] fix assert triggers (bugs 109 and 96), and put in some



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

Modified Files:
	connection.c connection_edge.c relay.c 
Log Message:
fix assert triggers (bugs 109 and 96), and put in some
debugging logs to notice future repeat bugs.


Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.339
retrieving revision 1.340
diff -u -d -r1.339 -r1.340
--- connection.c	22 Mar 2005 23:57:18 -0000	1.339
+++ connection.c	23 Mar 2005 02:52:55 -0000	1.340
@@ -1616,8 +1616,10 @@
     tor_assert(conn->socks_request);
     if (conn->state == AP_CONN_STATE_OPEN) {
       tor_assert(conn->socks_request->has_finished);
-      tor_assert(conn->cpath_layer);
-      assert_cpath_layer_ok(conn->cpath_layer);
+      if (!conn->marked_for_close) {
+        tor_assert(conn->cpath_layer);
+        assert_cpath_layer_ok(conn->cpath_layer);
+      }
     }
   } else {
     tor_assert(!conn->socks_request);

Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- connection_edge.c	23 Mar 2005 00:19:51 -0000	1.302
+++ connection_edge.c	23 Mar 2005 02:52:55 -0000	1.303
@@ -115,6 +115,7 @@
   conn->has_sent_end = 1; /* we're closing the circuit, nothing to send to */
   connection_mark_for_close(conn);
   conn->hold_open_until_flushed = 1;
+  conn->cpath_layer = NULL;
   return 0;
 }
 
@@ -141,6 +142,12 @@
     return -1;
   }
 
+  if (conn->marked_for_close) {
+    log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.",
+           conn->marked_for_close_file, conn->marked_for_close);
+    return 0;
+  }
+
   payload[0] = reason;
   if (reason == END_STREAM_REASON_EXITPOLICY) {
     /* this is safe even for rend circs, because they never fail

Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- relay.c	22 Mar 2005 19:36:38 -0000	1.51
+++ relay.c	23 Mar 2005 02:52:55 -0000	1.52
@@ -407,6 +407,12 @@
   relay_header_t rh;
   int cell_direction;
 
+  if (fromconn->marked_for_close) {
+    log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.",
+           fromconn->marked_for_close_file, fromconn->marked_for_close);
+    return 0;
+  }
+
   if (!circ) {
     log_fn(LOG_WARN,"no circ. Closing conn.");
     tor_assert(fromconn);
@@ -974,6 +980,11 @@
 
   tor_assert(conn);
   tor_assert(!connection_speaks_cells(conn));
+  if (conn->marked_for_close) {
+    log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.",
+           conn->marked_for_close_file, conn->marked_for_close);
+    return 0;
+  }
 
 repeat_connection_edge_package_raw_inbuf: