[or-cvs] backport the fix to send create cells more reliably after
arma at seul.org
arma at seul.org
Tue Jun 6 04:42:16 UTC 2006
Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/tor-011x/tor/src/or
Modified Files:
Tag: tor-0_1_1-patches
circuitbuild.c
Log Message:
backport the fix to send create cells more reliably after
the connection is established.
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.230.2.2
retrieving revision 1.230.2.3
diff -u -p -d -r1.230.2.2 -r1.230.2.3
--- circuitbuild.c 5 Jun 2006 08:59:28 -0000 1.230.2.2
+++ circuitbuild.c 6 Jun 2006 04:42:14 -0000 1.230.2.3
@@ -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_con
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_con
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
More information about the tor-commits
mailing list