make unattached rend streams expire after a while (60s)

(they were darned persistent)

also make intro circs that are waiting for acks expire after a while (20s)


svn:r1628
This commit is contained in:
Roger Dingledine 2004-04-15 01:08:59 +00:00
parent ac38746b3b
commit 26c1c8f173
2 changed files with 14 additions and 6 deletions

View File

@ -485,12 +485,12 @@ void circuit_expire_building(time_t now) {
victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) &&
victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
if(victim->n_conn)
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s)",
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s, purpose %d)",
victim->n_conn->address, victim->n_port, victim->n_circ_id,
victim->state, circuit_state_to_string[victim->state]);
victim->state, circuit_state_to_string[victim->state], victim->purpose);
else
log_fn(LOG_INFO,"Abandoning circ %d (state %d:%s)", victim->n_circ_id,
victim->state, circuit_state_to_string[victim->state]);
log_fn(LOG_INFO,"Abandoning circ %d (state %d:%s, purpose %d)", victim->n_circ_id,
victim->state, circuit_state_to_string[victim->state], victim->purpose);
circuit_log_path(LOG_INFO,victim);
circuit_mark_for_close(victim);
}

View File

@ -871,6 +871,12 @@ int connection_ap_handshake_attach_circuit(connection_t *conn) {
assert(conn->state == AP_CONN_STATE_CIRCUIT_WAIT);
assert(conn->socks_request);
if(conn->timestamp_created < time(NULL)-60) {
/* XXX make this cleaner than '60' */
log_fn(LOG_WARN,"Giving up on attached circ (60s late).");
connection_mark_for_close(conn, 0);
}
if(!connection_edge_is_rendezvous_stream(conn)) { /* we're a general conn */
circuit_t *circ=NULL;
@ -941,8 +947,10 @@ int connection_ap_handshake_attach_circuit(connection_t *conn) {
if(rend_client_send_introduction(introcirc, rendcirc) < 0) {
return -1;
}
if(!rendcirc->timestamp_dirty)
rendcirc->timestamp_dirty = time(NULL);
assert(!rendcirc->timestamp_dirty);
rendcirc->timestamp_dirty = time(NULL);
assert(!introcirc->timestamp_dirty);
introcirc->timestamp_dirty = time(NULL);
return 0;
}
}