diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-31 23:06:16 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-31 23:06:16 +0000 |
commit | ee45ae575d282cd8b7deb63522b4f982096ae5ab (patch) | |
tree | 15d337f2c1a8175eb6d7eb2a6476c162f0263a57 /src/or/circuit.c | |
parent | 289481314156c1c357712af94accab74bdee076d (diff) | |
download | tor-ee45ae575d282cd8b7deb63522b4f982096ae5ab.tar tor-ee45ae575d282cd8b7deb63522b4f982096ae5ab.tar.gz |
allow conns to demand to be attached to a clean circuit
(nobody uses this yet)
svn:r1417
Diffstat (limited to 'src/or/circuit.c')
-rw-r--r-- | src/or/circuit.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 017194dae..8762174a3 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -249,18 +249,22 @@ circuit_t *circuit_get_by_conn(connection_t *conn) { * If !conn, return newest. * * If must_be_open, ignore circs not in CIRCUIT_STATE_OPEN. + * If must_be_clean, ignore circs that have been used before. */ -circuit_t *circuit_get_newest(connection_t *conn, int must_be_open) { +circuit_t *circuit_get_newest(connection_t *conn, + int must_be_open, int must_be_clean) { circuit_t *circ, *newest=NULL, *leastdirty=NULL; routerinfo_t *exitrouter; - for(circ=global_circuitlist;circ;circ = circ->next) { - if(!circ->cpath) + for (circ=global_circuitlist;circ;circ = circ->next) { + if (!circ->cpath) continue; /* this circ doesn't start at us */ - if(must_be_open && (circ->state != CIRCUIT_STATE_OPEN || !circ->n_conn)) + if (must_be_open && (circ->state != CIRCUIT_STATE_OPEN || !circ->n_conn)) continue; /* ignore non-open circs */ if (circ->marked_for_close) continue; + if (must_be_clean && circ->timestamp_dirty) + continue; /* ignore dirty circs */ if(conn) { if(circ->state == CIRCUIT_STATE_OPEN && circ->n_conn) /* open */ exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port); |