mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
bugfix: refactor to always use circuit_remove
this way we can always check if a new circ needs to be launched svn:r254
This commit is contained in:
parent
ffae44aafd
commit
f54186aa91
@ -522,8 +522,10 @@ void circuit_close(circuit_t *circ) {
|
|||||||
circuit_t *youngest=NULL;
|
circuit_t *youngest=NULL;
|
||||||
|
|
||||||
assert(circ);
|
assert(circ);
|
||||||
if(options.APPort)
|
if(options.APPort) {
|
||||||
youngest = circuit_get_newest_by_edge_type(EDGE_AP);
|
youngest = circuit_get_newest_by_edge_type(EDGE_AP);
|
||||||
|
log(LOG_DEBUG,"circuit_close(): youngest %d, circ %d.",youngest,circ);
|
||||||
|
}
|
||||||
circuit_remove(circ);
|
circuit_remove(circ);
|
||||||
for(conn=circ->n_conn; conn; conn=conn->next_topic) {
|
for(conn=circ->n_conn; conn; conn=conn->next_topic) {
|
||||||
connection_send_destroy(circ->n_aci, circ->n_conn);
|
connection_send_destroy(circ->n_aci, circ->n_conn);
|
||||||
@ -585,17 +587,13 @@ send_end:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this connection speaks cells. We must close all the circuits on it. */
|
||||||
while((circ = circuit_get_by_conn(conn))) {
|
while((circ = circuit_get_by_conn(conn))) {
|
||||||
circuit_remove(circ);
|
|
||||||
if(circ->n_conn == conn) /* it's closing in front of us */
|
if(circ->n_conn == conn) /* it's closing in front of us */
|
||||||
for(tmpconn=circ->p_conn; tmpconn; tmpconn=tmpconn->next_topic) {
|
circ->n_conn = NULL;
|
||||||
connection_send_destroy(circ->p_aci, tmpconn);
|
|
||||||
}
|
|
||||||
if(circ->p_conn == conn) /* it's closing behind us */
|
if(circ->p_conn == conn) /* it's closing behind us */
|
||||||
for(tmpconn=circ->n_conn; tmpconn; tmpconn=tmpconn->next_topic) {
|
circ->p_conn = NULL;
|
||||||
connection_send_destroy(circ->n_aci, tmpconn);
|
circuit_close(circ);
|
||||||
}
|
|
||||||
circuit_free(circ);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,6 +642,9 @@ void circuit_expire_unused_circuits(void) {
|
|||||||
void circuit_launch_new(int failure_status) {
|
void circuit_launch_new(int failure_status) {
|
||||||
static int failures=0;
|
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 */
|
if(failure_status == -1) { /* I was called because a circuit succeeded */
|
||||||
failures = 0;
|
failures = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -272,19 +272,11 @@ void command_process_destroy_cell(cell_t *cell, connection_t *conn) {
|
|||||||
onion_pending_remove(circ);
|
onion_pending_remove(circ);
|
||||||
}
|
}
|
||||||
|
|
||||||
circuit_remove(circ);
|
if(cell->aci == circ->p_aci) /* the destroy came from behind */
|
||||||
|
circ->p_conn = NULL;
|
||||||
if(cell->aci == circ->p_aci) { /* the destroy came from behind */
|
if(cell->aci == circ->n_aci) /* the destroy came from ahead */
|
||||||
for(tmpconn = circ->n_conn; tmpconn; tmpconn=tmpconn->next_topic) {
|
circ->n_conn = NULL;
|
||||||
connection_send_destroy(circ->n_aci, tmpconn);
|
circuit_close(circ);
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user