[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[or-cvs] two more rare race conditions
Update of /home/or/cvsroot/src/or
In directory moria.seul.org:/home/arma/work/onion/cvs/src/or
Modified Files:
circuit.c onion.c
Log Message:
two more rare race conditions
Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- circuit.c 27 Nov 2002 04:08:19 -0000 1.16
+++ circuit.c 28 Nov 2002 07:32:23 -0000 1.17
@@ -359,9 +359,11 @@
while((circ = circuit_get_by_conn(conn))) {
circuit_remove(circ);
if(circ->n_conn == conn) /* it's closing in front of us */
+ /* circ->p_conn should always be set */
connection_send_destroy(circ->p_aci, circ->p_conn);
if(circ->p_conn == conn) /* it's closing behind us */
- connection_send_destroy(circ->n_aci, circ->n_conn);
+ if(circ->n_conn)
+ connection_send_destroy(circ->n_aci, circ->n_conn);
circuit_free(circ);
}
}
Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- onion.c 27 Nov 2002 04:08:20 -0000 1.21
+++ onion.c 28 Nov 2002 07:32:30 -0000 1.22
@@ -87,23 +87,25 @@
void onion_pending_process_one(void) {
struct data_queue_t *tmpd;
+ circuit_t *circ;
if(!ol_list)
return; /* no onions pending, we're done */
assert(ol_list->circ && ol_list->circ->p_conn);
assert(ol_length > 0);
+ circ = ol_list->circ;
- if(onion_process(ol_list->circ) < 0) {
+ if(onion_process(circ) < 0) {
log(LOG_DEBUG,"onion_pending_process_one(): Failed. Closing.");
- onion_pending_remove(ol_list->circ);
- circuit_close(ol_list->circ);
+ onion_pending_remove(circ);
+ circuit_close(circ);
} else {
log(LOG_DEBUG,"onion_pending_process_one(): Succeeded. Delivering queued data cells.");
for(tmpd = ol_list->data_cells; tmpd; tmpd=tmpd->next) {
- command_process_data_cell(tmpd->cell, ol_list->circ->p_conn);
+ command_process_data_cell(tmpd->cell, circ->p_conn);
}
- onion_pending_remove(ol_list->circ);
+ onion_pending_remove(circ);
}
return;
}