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

[or-cvs] fix two assert triggers (darn it, I hate releasing software)



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

Modified Files:
	connection_or.c directory.c 
Log Message:
fix two assert triggers (darn it, I hate releasing software)

when connecting to a dirserver or OR and the network is down,
we would crash.


Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- connection_or.c	21 Mar 2004 03:18:45 -0000	1.90
+++ connection_or.c	26 Mar 2004 22:07:44 -0000	1.91
@@ -111,6 +111,7 @@
 
   /* set up conn so it's got all the data we need to remember */
   connection_or_init_conn_from_router(conn, router);
+  conn->state = OR_CONN_STATE_CONNECTING;
 
   if(connection_add(conn) < 0) { /* no space, forget it */
     connection_free(conn);
@@ -126,7 +127,6 @@
       connection_watch_events(conn, POLLIN | POLLOUT | POLLERR);
       /* writable indicates finish, readable indicates broken link,
          error indicates broken link on windows */
-      conn->state = OR_CONN_STATE_CONNECTING;
       return conn;
     /* case 1: fall through */
   }

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- directory.c	21 Mar 2004 03:18:45 -0000	1.66
+++ directory.c	26 Mar 2004 22:07:45 -0000	1.67
@@ -40,6 +40,8 @@
   assert(router->identity_pkey);
   conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
 
+  conn->state = command;
+
   if(connection_add(conn) < 0) { /* no space, forget it */
     connection_free(conn);
     return;
@@ -55,7 +57,6 @@
       connection_watch_events(conn, POLLIN | POLLOUT | POLLERR);
       /* writable indicates finish, readable indicates broken link,
          error indicates broken link in windowsland. */
-      conn->state = command;
       return;
     /* case 1: fall through */
   }
@@ -76,7 +77,6 @@
   switch(command) {
     case DIR_CONN_STATE_CONNECTING_FETCH:
       connection_write_to_buf(fetchstring, strlen(fetchstring), conn);
-      conn->state = DIR_CONN_STATE_CLIENT_SENDING_FETCH;
       break;
     case DIR_CONN_STATE_CONNECTING_UPLOAD:
       s = router_get_my_descriptor();
@@ -87,7 +87,6 @@
       snprintf(tmp, sizeof(tmp), "POST / HTTP/1.0\r\nContent-Length: %d\r\n\r\n%s",
                (int)strlen(s), s);
       connection_write_to_buf(tmp, strlen(tmp), conn);
-      conn->state = DIR_CONN_STATE_CLIENT_SENDING_UPLOAD;
       break;
   }
   return 0;