aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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,