[or-cvs] fix some bugs in assert_connection_ok

Roger Dingledine arma at seul.org
Tue Feb 24 22:33:33 UTC 2004


Update of /home2/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv20034

Modified Files:
	connection.c dns.c 
Log Message:
fix some bugs in assert_connection_ok


Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/src/or/connection.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- connection.c	31 Jan 2004 00:36:00 -0000	1.149
+++ connection.c	24 Feb 2004 22:33:30 -0000	1.150
@@ -778,7 +778,7 @@
     if(conn->state == OR_CONN_STATE_OPEN) {
       assert(conn->bandwidth > 0);
       assert(conn->receiver_bucket >= 0);
-      assert(conn->receiver_bucket <= 10*conn->bandwidth);
+//      assert(conn->receiver_bucket <= 10*conn->bandwidth);
     }
     assert(conn->addr && conn->port);
     assert(conn->address);
@@ -795,14 +795,11 @@
     assert(!conn->done_sending);
     assert(!conn->done_receiving);
   } else {
-    assert(!conn->next_stream ||
-           conn->next_stream->type == CONN_TYPE_EXIT ||
-           conn->next_stream->type == CONN_TYPE_AP);
     if(conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN)
       assert(conn->cpath_layer);
     if(conn->cpath_layer)
       assert_cpath_layer_ok(conn->cpath_layer);
-    /* XXX unchecked, package window, deliver window. */
+    /* XXX unchecked: package window, deliver window. */
   }
   if (conn->type != CONN_TYPE_AP) {
     assert(!conn->socks_request);
@@ -835,6 +832,7 @@
     case CONN_TYPE_DNSWORKER:
       assert(conn->state == DNSWORKER_STATE_IDLE ||
              conn->state == DNSWORKER_STATE_BUSY);
+      break;
     case CONN_TYPE_CPUWORKER:
       assert(conn->state >= _CPUWORKER_STATE_MIN &&
              conn->state <= _CPUWORKER_STATE_MAX);

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/src/or/dns.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- dns.c	22 Feb 2004 20:50:20 -0000	1.49
+++ dns.c	24 Feb 2004 22:33:30 -0000	1.50
@@ -337,9 +337,7 @@
       if(connection_edge_end(pend->conn, END_STREAM_REASON_RESOLVEFAILED, NULL) < 0)
         log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");
     } else {
-      /* XXX should call assert_connection_ok here */
-      assert(pend->conn->type >= _CONN_TYPE_MIN);
-      assert(pend->conn->type <= _CONN_TYPE_MAX);
+      assert_connection_ok(pend->conn, time(NULL));
       connection_exit_connect(pend->conn);
     }
     resolve->pending_connections = pend->next;



More information about the tor-commits mailing list