[or-cvs] flagday] Make connections finally work again. Circs claim ...

Nick Mathewson nickm at seul.org
Sat Apr 17 18:48:05 UTC 2004


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

Modified Files:
      Tag: tor-0_0_6incompat
	connection_or.c 
Log Message:
[flagday] Make connections finally work again.  Circs claim to get built, too.

Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.94.2.2
retrieving revision 1.94.2.3
diff -u -d -r1.94.2.2 -r1.94.2.3
--- connection_or.c	17 Apr 2004 18:15:00 -0000	1.94.2.2
+++ connection_or.c	17 Apr 2004 18:48:02 -0000	1.94.2.3
@@ -213,17 +213,21 @@
   }
   log_fn(LOG_DEBUG,"The router's cert is valid.");
 
-  if((c=connection_exact_get_by_addr_port(router->addr,router->or_port))) {
-    log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", router->nickname, c->s, conn->s);
-    return -1;
-  }
-  if (conn->nickname && strcmp(conn->nickname, nickname)) {
-    log_fn(options.DirPort ? LOG_WARN : LOG_INFO,
-           "Other side is '%s', but we tried to connect to '%s'",
-           nickname, conn->nickname);
-    return -1;
+  if (conn->nickname) {
+    /* I initiated this connection. */
+    if (strcmp(conn->nickname, nickname)) {
+      log_fn(options.DirPort ? LOG_WARN : LOG_INFO,
+             "Other side is '%s', but we tried to connect to '%s'",
+             nickname, conn->nickname);
+      return -1;
+    }
+  } else {
+    if((c=connection_exact_get_by_addr_port(router->addr,router->or_port))) {
+      log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", router->nickname, c->s, conn->s);
+      return -1;
+    }
+    connection_or_init_conn_from_router(conn,router);
   }
-  connection_or_init_conn_from_router(conn,router);
 
   if (!options.ORPort) { /* If I'm an OP... */
     conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;



More information about the tor-commits mailing list