diff options
author | Roger Dingledine <arma@torproject.org> | 2006-06-06 04:42:14 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-06-06 04:42:14 +0000 |
commit | 6834912f6e46508f48578f0dce8472ea15f2cd29 (patch) | |
tree | 1c9a99a5508a836ba8bf07a2f06bdce09ddde0b1 /src | |
parent | ca02aefbc92a19476eb9ff5b271bbd246d57387b (diff) | |
download | tor-6834912f6e46508f48578f0dce8472ea15f2cd29.tar.gz tor-6834912f6e46508f48578f0dce8472ea15f2cd29.zip |
backport the fix to send create cells more reliably after
the connection is established.
svn:r6553
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 17128f7b25..4a39cff844 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -404,6 +404,7 @@ void circuit_n_conn_done(connection_t *or_conn, int status) { extern smartlist_t *circuits_pending_or_conns; + smartlist_t *changed_circs; log_debug(LD_CIRC,"or_conn to %s, status=%d", or_conn->nickname ? or_conn->nickname : "NULL", status); @@ -411,6 +412,8 @@ circuit_n_conn_done(connection_t *or_conn, int status) if (!circuits_pending_or_conns) return; + changed_circs = smartlist_create(); + SMARTLIST_FOREACH(circuits_pending_or_conns, circuit_t *, circ, { if (circ->marked_for_close) @@ -449,10 +452,18 @@ circuit_n_conn_done(connection_t *or_conn, int status) continue; } tor_free(circ->onionskin); - circuit_set_state(circ, CIRCUIT_STATE_OPEN); + /* We don't want to change circ's state here, since the act + * of doing that modifies the circuits_pending_or_conns list + * that we're looping through right now. So collect a list of + * circs to change their state when we're done. */ + smartlist_add(changed_circs, circ); } } }); + + SMARTLIST_FOREACH(changed_circs, circuit_t *, circ, + circuit_set_state(circ, CIRCUIT_STATE_OPEN)); + smartlist_free(changed_circs); } /** Find a new circid that isn't currently in use on the circ->n_conn |