Browse Source

bugfix: sometimes we closed a circ while cpuworker was cranking,
and it didn't notice


svn:r841

Roger Dingledine 20 years ago
parent
commit
25ac8857f3
2 changed files with 8 additions and 2 deletions
  1. 5 2
      src/or/circuit.c
  2. 3 0
      src/or/onion.c

+ 5 - 2
src/or/circuit.c

@@ -552,6 +552,10 @@ void circuit_close(circuit_t *circ) {
 
   assert(circ);
   circuit_remove(circ);
+  if(circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
+    onion_pending_remove(circ);
+  }
+
   if(circ->n_conn)
     connection_send_destroy(circ->n_circ_id, circ->n_conn);
   for(conn=circ->n_streams; conn; conn=conn->next_stream) {
@@ -706,7 +710,6 @@ int circuit_launch_new(int failure_status) {
   }
 
   if(circuit_establish_circuit() < 0) {
-    failures++;
     return 0;
   }
 
@@ -746,7 +749,7 @@ int circuit_establish_circuit(void) {
     circ->n_port = firsthop->or_port;
     if(options.OnionRouter) { /* we would be connected if he were up. but he's not. */
       log_fn(LOG_INFO,"Route's firsthop isn't connected.");
-      circuit_close(circ); 
+      circuit_close(circ);
       return -1;
     }
 

+ 3 - 0
src/or/onion.c

@@ -69,11 +69,14 @@ circuit_t *onion_next_task(void) {
     return NULL; /* no onions pending, we're done */
 
   assert(ol_list->circ);
+  assert(ol_list->circ->p_conn); /* make sure it's still valid */
+#if 0
   if(!ol_list->circ->p_conn) {
     log_fn(LOG_INFO,"ol_list->circ->p_conn null, must have died?");
     onion_pending_remove(ol_list->circ);
     return onion_next_task(); /* recurse: how about the next one? */
   }
+#endif
 
   assert(ol_length > 0);
   circ = ol_list->circ;