aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-11-17 00:57:56 +0000
committerRoger Dingledine <arma@torproject.org>2003-11-17 00:57:56 +0000
commit4aede010b9e2bb53c3dfc954bfe0ff393d03525f (patch)
treebe95524a9442058978be67670b555cfca9cf7c44 /src/or/connection_edge.c
parent5e81e4748e8a631822684362b0c3ea40c492061b (diff)
downloadtor-4aede010b9e2bb53c3dfc954bfe0ff393d03525f.tar
tor-4aede010b9e2bb53c3dfc954bfe0ff393d03525f.tar.gz
recognize in-progress circs and don't start redundant ones
quickly notice streams that don't have a circ on the way, and start one svn:r819
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 849d4afe6..d20f1d405 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -481,7 +481,6 @@ void connection_ap_attach_pending(void)
{
connection_t **carray;
int n, i;
- int need_new_circuit = 0;
get_connection_array(&carray, &n);
@@ -490,11 +489,12 @@ void connection_ap_attach_pending(void)
carray[i]->type != AP_CONN_STATE_CIRCUIT_WAIT)
continue;
if (connection_ap_handshake_attach_circuit(carray[i])<0) {
- need_new_circuit = 1;
+ if(!circuit_get_newest(carray[i], 0)) {
+ /* if there are no acceptable clean or not-very-dirty circs on the way */
+ circuit_launch_new(1);
+ }
}
}
- if(need_new_circuit)
- circuit_launch_new(1);
}
static void connection_edge_consider_sending_sendme(connection_t *conn) {
@@ -549,9 +549,8 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
} /* else socks handshake is done, continue processing */
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
- if (connection_ap_handshake_attach_circuit(conn)<0) {
- circuit_launch_new(1);
- }
+ if(connection_ap_handshake_attach_circuit(conn) < 0)
+ circuit_launch_new(1); /* Build another circuit to handle this stream */
return 0;
}
@@ -569,7 +568,7 @@ static int connection_ap_handshake_attach_circuit(connection_t *conn) {
assert(conn->socks_request);
/* find the circuit that we should use, if there is one. */
- circ = circuit_get_newest_open(conn);
+ circ = circuit_get_newest(conn, 1);
if(!circ) {
log_fn(LOG_INFO,"No safe circuit ready for edge connection; delaying.");