[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] bugfix: refactor to always use circuit_remove
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home/arma/work/onion/cvs/src/or
Modified Files:
circuit.c command.c
Log Message:
bugfix: refactor to always use circuit_remove
this way we can always check if a new circ needs to be launched
Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- circuit.c 18 Apr 2003 18:47:49 -0000 1.36
+++ circuit.c 20 Apr 2003 19:47:33 -0000 1.37
@@ -522,8 +522,10 @@
circuit_t *youngest=NULL;
assert(circ);
- if(options.APPort)
+ if(options.APPort) {
youngest = circuit_get_newest_by_edge_type(EDGE_AP);
+ log(LOG_DEBUG,"circuit_close(): youngest %d, circ %d.",youngest,circ);
+ }
circuit_remove(circ);
for(conn=circ->n_conn; conn; conn=conn->next_topic) {
connection_send_destroy(circ->n_aci, circ->n_conn);
@@ -585,17 +587,13 @@
return;
}
+ /* this connection speaks cells. We must close all the circuits on it. */
while((circ = circuit_get_by_conn(conn))) {
- circuit_remove(circ);
if(circ->n_conn == conn) /* it's closing in front of us */
- for(tmpconn=circ->p_conn; tmpconn; tmpconn=tmpconn->next_topic) {
- connection_send_destroy(circ->p_aci, tmpconn);
- }
+ circ->n_conn = NULL;
if(circ->p_conn == conn) /* it's closing behind us */
- for(tmpconn=circ->n_conn; tmpconn; tmpconn=tmpconn->next_topic) {
- connection_send_destroy(circ->n_aci, tmpconn);
- }
- circuit_free(circ);
+ circ->p_conn = NULL;
+ circuit_close(circ);
}
}
@@ -643,6 +641,9 @@
*/
void circuit_launch_new(int failure_status) {
static int failures=0;
+
+ if(!options.APPort) /* we're not an application proxy. no need for circuits. */
+ return;
if(failure_status == -1) { /* I was called because a circuit succeeded */
failures = 0;
Index: command.c
===================================================================
RCS file: /home/or/cvsroot/src/or/command.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- command.c 16 Apr 2003 23:21:44 -0000 1.22
+++ command.c 20 Apr 2003 19:47:33 -0000 1.23
@@ -272,19 +272,11 @@
onion_pending_remove(circ);
}
- circuit_remove(circ);
-
- if(cell->aci == circ->p_aci) { /* the destroy came from behind */
- for(tmpconn = circ->n_conn; tmpconn; tmpconn=tmpconn->next_topic) {
- connection_send_destroy(circ->n_aci, tmpconn);
- }
- }
- if(cell->aci == circ->n_aci) { /* the destroy came from ahead */
- for(tmpconn = circ->p_conn; tmpconn; tmpconn=tmpconn->next_topic) {
- connection_send_destroy(circ->p_aci, tmpconn);
- }
- }
- circuit_free(circ);
+ if(cell->aci == circ->p_aci) /* the destroy came from behind */
+ circ->p_conn = NULL;
+ if(cell->aci == circ->n_aci) /* the destroy came from ahead */
+ circ->n_conn = NULL;
+ circuit_close(circ);
}
/*