If the controller claimed responsibility for a stream, but that

stream never finished making its connection, it would live
forever in circuit_wait state. Now we close it after SocksTimeout
seconds. Bugfix on 0.1.2.7-alpha; reported by Mike Perry.


svn:r18516
This commit is contained in:
Roger Dingledine 2009-02-13 04:11:14 +00:00
parent ed9b10dd2b
commit c8474f9d93
2 changed files with 16 additions and 12 deletions

View File

@ -1,4 +1,4 @@
Changes in version 0.2.1.13-????? - 2009-0?-?? Changes in version 0.2.1.13-????? - 2009-02-??
o Minor bugfixes: o Minor bugfixes:
- Automatically detect MacOSX versions earlier than 10.4.0, and - Automatically detect MacOSX versions earlier than 10.4.0, and
disable kqueue from inside Tor when running with these versions. disable kqueue from inside Tor when running with these versions.
@ -19,6 +19,10 @@ Changes in version 0.2.1.13-????? - 2009-0?-??
- When we can't transmit a DNS request due to a network error, retry - When we can't transmit a DNS request due to a network error, retry
it after a while, and eventually transmit a failing response to the it after a while, and eventually transmit a failing response to the
RESOLVED cell. Bugfix on 0.1.2.5-alpha. RESOLVED cell. Bugfix on 0.1.2.5-alpha.
- If the controller claimed responsibility for a stream, but that
stream never finished making its connection, it would live
forever in circuit_wait state. Now we close it after SocksTimeout
seconds. Bugfix on 0.1.2.7-alpha; reported by Mike Perry.
o Minor features: o Minor features:
- On Linux, use the prctl call to re-enable core dumps when the user - On Linux, use the prctl call to re-enable core dumps when the user

View File

@ -397,7 +397,7 @@ connection_ap_expire_beginning(void)
or_options_t *options = get_options(); or_options_t *options = get_options();
int severity; int severity;
int cutoff; int cutoff;
int seconds_idle; int seconds_idle, seconds_since_born;
smartlist_t *conns = get_connection_array(); smartlist_t *conns = get_connection_array();
SMARTLIST_FOREACH_BEGIN(conns, connection_t *, c) { SMARTLIST_FOREACH_BEGIN(conns, connection_t *, c) {
@ -408,18 +408,21 @@ connection_ap_expire_beginning(void)
severity = (tor_addr_is_null(&conn->_base.addr) && !conn->_base.port) severity = (tor_addr_is_null(&conn->_base.addr) && !conn->_base.port)
? LOG_INFO : LOG_NOTICE; ? LOG_INFO : LOG_NOTICE;
seconds_idle = (int)( now - conn->_base.timestamp_lastread ); seconds_idle = (int)( now - conn->_base.timestamp_lastread );
seconds_since_born = (int)( now - conn->_base.timestamp_created );
/* XXX021 this clause was originally thought redundant with the if (conn->_base.state == AP_CONN_STATE_OPEN)
* clause in connection_ap_handshake_attach_circuit(). But actually, continue;
* we need it because controllers that put streams in controller_wait
* state never go to the other clause. we should fix so it compares /* We already consider SocksTimeout in
* seconds since timestamp_created, not since last read. -RD */ * connection_ap_handshake_attach_circuit(), but we need to consider
* it here too because controllers that put streams in controller_wait
* state never ask Tor to attach the circuit. */
if (AP_CONN_STATE_IS_UNATTACHED(conn->_base.state)) { if (AP_CONN_STATE_IS_UNATTACHED(conn->_base.state)) {
if (seconds_idle >= options->SocksTimeout) { if (seconds_since_born >= options->SocksTimeout) {
log_fn(severity, LD_APP, log_fn(severity, LD_APP,
"Tried for %d seconds to get a connection to %s:%d. " "Tried for %d seconds to get a connection to %s:%d. "
"Giving up. (%s)", "Giving up. (%s)",
seconds_idle, safe_str(conn->socks_request->address), seconds_since_born, safe_str(conn->socks_request->address),
conn->socks_request->port, conn->socks_request->port,
conn_state_to_string(CONN_TYPE_AP, conn->_base.state)); conn_state_to_string(CONN_TYPE_AP, conn->_base.state));
connection_mark_unattached_ap(conn, END_STREAM_REASON_TIMEOUT); connection_mark_unattached_ap(conn, END_STREAM_REASON_TIMEOUT);
@ -427,9 +430,6 @@ connection_ap_expire_beginning(void)
continue; continue;
} }
if (conn->_base.state == AP_CONN_STATE_OPEN)
continue;
/* We're in state connect_wait or resolve_wait now -- waiting for a /* We're in state connect_wait or resolve_wait now -- waiting for a
* reply to our relay cell. See if we want to retry/give up. */ * reply to our relay cell. See if we want to retry/give up. */