diff --git a/src/or/circuit.c b/src/or/circuit.c index 1a673b2562..09eb30b541 100644 --- a/src/or/circuit.c +++ b/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; } diff --git a/src/or/onion.c b/src/or/onion.c index 84f43e9e88..907bd6606f 100644 --- a/src/or/onion.c +++ b/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;