more useful log messages when we give up on a stream

svn:r9552
This commit is contained in:
Roger Dingledine 2007-02-11 02:15:42 +00:00
parent a1c8055131
commit 731d37f717
2 changed files with 22 additions and 25 deletions

View File

@ -99,13 +99,13 @@ conn_state_to_string(int type, int state)
break;
case CONN_TYPE_AP:
switch (state) {
case AP_CONN_STATE_SOCKS_WAIT: return "waiting for dest info";
case AP_CONN_STATE_SOCKS_WAIT: return "waiting for socks info";
case AP_CONN_STATE_NATD_WAIT: return "waiting for natd dest info";
case AP_CONN_STATE_RENDDESC_WAIT: return "waiting for rendezvous desc";
case AP_CONN_STATE_CONTROLLER_WAIT: return "waiting for controller";
case AP_CONN_STATE_CIRCUIT_WAIT: return "waiting for safe circuit";
case AP_CONN_STATE_CONNECT_WAIT: return "waiting for connect";
case AP_CONN_STATE_RESOLVE_WAIT: return "waiting for resolve";
case AP_CONN_STATE_CIRCUIT_WAIT: return "waiting for circuit";
case AP_CONN_STATE_CONNECT_WAIT: return "waiting for connect response";
case AP_CONN_STATE_RESOLVE_WAIT: return "waiting for resolve response";
case AP_CONN_STATE_OPEN: return "open";
}
break;

View File

@ -372,28 +372,25 @@ connection_ap_expire_beginning(void)
if (AP_CONN_STATE_IS_UNATTACHED(conn->_base.state)) {
if (seconds_idle >= options->SocksTimeout) {
if (conn->_base.state == AP_CONN_STATE_CIRCUIT_WAIT) {
log_fn(severity, LD_APP,
"Tried for %d seconds to get a connection to %s:%d. Giving up.",
log_fn(severity, LD_APP,
"Tried for %d seconds to get a connection to %s:%d. "
"Giving up. (%s)",
seconds_idle, safe_str(conn->socks_request->address),
conn->socks_request->port);
} else {
log_fn(severity, LD_APP, "Closing unattached stream (state %d).",
conn->_base.state);
/* XXX012 remove the below clause before stable release -RD */
if (conn->_base.state == AP_CONN_STATE_SOCKS_WAIT) {
/* extra debugging */
log_fn(severity, LD_APP,
"Hints: is_reading %d, inbuf len %lu, socks: version %d, "
"command %d, has_finished %d, address %s, port %d.",
connection_is_reading(TO_CONN(conn)),
(unsigned long)buf_datalen(conn->_base.inbuf),
(int)conn->socks_request->socks_version,
conn->socks_request->command,
conn->socks_request->has_finished,
conn->socks_request->address,
(int)conn->socks_request->port);
}
conn->socks_request->port,
conn_state_to_string(CONN_TYPE_AP, conn->_base.state));
/* XXX012 remove the below clause before stable release -RD */
if (conn->_base.state == AP_CONN_STATE_SOCKS_WAIT) {
/* extra debugging */
log_fn(severity, LD_APP,
"Hints: is_reading %d, inbuf len %lu, socks: version %d, "
"command %d, has_finished %d, address %s, port %d.",
connection_is_reading(TO_CONN(conn)),
(unsigned long)buf_datalen(conn->_base.inbuf),
(int)conn->socks_request->socks_version,
conn->socks_request->command,
conn->socks_request->has_finished,
conn->socks_request->address,
(int)conn->socks_request->port);
}
connection_mark_unattached_ap(conn, END_STREAM_REASON_TIMEOUT);
}