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

[or-cvs] patches to try to track down glenn fink"s bug



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

Modified Files:
      Tag: tor-0_0_9-patches
	connection.c 
Log Message:
patches to try to track down glenn fink's bug


Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.310.2.5
retrieving revision 1.310.2.6
diff -u -d -r1.310.2.5 -r1.310.2.6
--- connection.c	1 Mar 2005 22:13:04 -0000	1.310.2.5
+++ connection.c	21 Mar 2005 21:51:17 -0000	1.310.2.6
@@ -471,9 +471,14 @@
   newconn = connection_new(new_type);
   newconn->s = news;
 
-  newconn->address = tor_strdup(inet_ntoa(remote.sin_addr)); /* remember the remote address */
+  /* remember the remote address */
+  newconn->address = tor_strdup(inet_ntoa(remote.sin_addr));
   newconn->addr = ntohl(remote.sin_addr.s_addr);
   newconn->port = ntohs(remote.sin_port);
+  if (!newconn->addr || !newconn->port) {
+    log_fn(LOG_WARN,"New conn (type %d) has zero addr/port: addr %s, port %d.",
+           new_type, newconn->address, newconn->port);
+  }
 
   if (connection_add(newconn) < 0) { /* no space, forget it */
     connection_free(newconn);
@@ -1459,7 +1464,7 @@
        */
       tor_assert(conn->receiver_bucket >= 0);
     }
-    tor_assert(conn->addr && conn->port);
+//    tor_assert(conn->addr && conn->port);
     tor_assert(conn->address);
     if (conn->state != OR_CONN_STATE_CONNECTING)
       tor_assert(conn->tls);
@@ -1533,6 +1538,7 @@
       tor_assert(conn->state <= _CONTROL_CONN_STATE_MAX);
       break;
     default:
+      log_fn(LOG_WARN,"Unexpected conn type %d", conn->type);
       tor_assert(0);
   }
 }