aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-07 20:38:23 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-07 20:38:23 +0000
commit505797e9985625d32debf7f0da4e705ae40e8f56 (patch)
treea2a283c672cc4d5e5a7d78a21cb44c98bde17712 /src
parent650d483beada051dec75c87df77825e321a20c68 (diff)
downloadtor-505797e9985625d32debf7f0da4e705ae40e8f56.tar
tor-505797e9985625d32debf7f0da4e705ae40e8f56.tar.gz
expire open-but-not-yet-acked circs if they're too old
svn:r1526
Diffstat (limited to 'src')
-rw-r--r--src/or/circuit.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index e8190ed2d..b8ed4228d 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -408,7 +408,7 @@ circuit_t *circuit_get_rendezvous(const char *cookie)
return NULL;
}
-#define MIN_SECONDS_BEFORE_EXPIRING_CIRC 10
+#define MIN_SECONDS_BEFORE_EXPIRING_CIRC 20
/* circuits that were born at the end of their second might be expired
* after 10.1 seconds; circuits born at the beginning might be expired
* after closer to 11 seconds.
@@ -423,10 +423,18 @@ void circuit_expire_building(void) {
while(circ) {
victim = circ;
circ = circ->next;
- if(victim->cpath &&
- victim->state != CIRCUIT_STATE_OPEN &&
- victim->timestamp_created + MIN_SECONDS_BEFORE_EXPIRING_CIRC+1 < now &&
- !victim->marked_for_close) {
+ if(!victim->cpath)
+ continue; /* didn't originate here */
+ if(victim->marked_for_close)
+ continue; /* don't mess with marked circs */
+ if(victim->timestamp_created + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)
+ continue; /* it's young still, don't mess with it */
+
+ /* if circ is !open, or if it's open but purpose is est intro or est rend,
+ * then mark it for close */
+ if(victim->state != CIRCUIT_STATE_OPEN ||
+ victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
+ victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO) {
if(victim->n_conn)
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s)",
victim->n_conn->address, victim->n_port, victim->n_circ_id,