bugfix: sometimes we closed a circ while cpuworker was cranking,

and it didn't notice


svn:r841
This commit is contained in:
Roger Dingledine 2003-11-18 21:12:17 +00:00
parent a6595f4579
commit 25ac8857f3
2 changed files with 8 additions and 2 deletions

View File

@ -552,6 +552,10 @@ void circuit_close(circuit_t *circ) {
assert(circ); assert(circ);
circuit_remove(circ); circuit_remove(circ);
if(circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
onion_pending_remove(circ);
}
if(circ->n_conn) if(circ->n_conn)
connection_send_destroy(circ->n_circ_id, circ->n_conn); connection_send_destroy(circ->n_circ_id, circ->n_conn);
for(conn=circ->n_streams; conn; conn=conn->next_stream) { 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) { if(circuit_establish_circuit() < 0) {
failures++;
return 0; return 0;
} }

View File

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