diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-27 05:45:52 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-27 05:45:52 +0000 |
commit | 56dfc3151ffd246e66697a02635c202bbdc31558 (patch) | |
tree | 670199ed04d3b36900c56d95e661089437b18b71 /src/or/connection.c | |
parent | 9ab5f3c067eb9b35aada9ee377927ca6b340c03b (diff) | |
download | tor-56dfc3151ffd246e66697a02635c202bbdc31558.tar.gz tor-56dfc3151ffd246e66697a02635c202bbdc31558.zip |
work around a tsocks bug
when an AP connection dies early, be sure to do a socks reject
for it. if you just hang up, tsocks goes into an infinite loop.
svn:r1352
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index c7f3867d04..75804ee02d 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -199,8 +199,14 @@ _connection_mark_for_close(connection_t *conn, char reason) } /* No special processing needed. */ break; - case CONN_TYPE_EXIT: case CONN_TYPE_AP: + if (conn->socks_request->has_finished == 0) { + log_fn(LOG_INFO,"Cleaning up AP -- sending socks reject."); + connection_ap_handshake_socks_reply(conn, NULL, 0, 0); + conn->socks_request->has_finished = 1; + } + /* fall through, to do things for both ap and exit */ + case CONN_TYPE_EXIT: if (conn->state == EXIT_CONN_STATE_RESOLVING) connection_dns_remove(conn); if (!conn->has_sent_end && reason && @@ -1004,13 +1010,16 @@ void assert_connection_ok(connection_t *conn, time_t now) assert(!conn->done_sending); assert(!conn->done_receiving); } else { - if(conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN) - assert(conn->cpath_layer); - if(conn->cpath_layer) - assert_cpath_layer_ok(conn->cpath_layer); /* XXX unchecked: package window, deliver window. */ } - if (conn->type != CONN_TYPE_AP) { + if (conn->type == CONN_TYPE_AP) { + assert(conn->socks_request); + if (conn->state == AP_CONN_STATE_OPEN) { + assert(conn->socks_request->has_finished); + assert(conn->cpath_layer); + assert_cpath_layer_ok(conn->cpath_layer); + } + } else { assert(!conn->socks_request); } |