diff options
author | Roger Dingledine <arma@torproject.org> | 2006-03-09 06:29:53 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-03-09 06:29:53 +0000 |
commit | 5f8d26496d312d280887eb1f2ccd984fac62e4c0 (patch) | |
tree | f35e0f886255de66590648a874899d052e6bb487 /src | |
parent | a0865e2f8e46594ffce38273b67ba05f7f6b8042 (diff) | |
download | tor-5f8d26496d312d280887eb1f2ccd984fac62e4c0.tar.gz tor-5f8d26496d312d280887eb1f2ccd984fac62e4c0.zip |
Let the controller attachstream conns that are in connect_wait
or resolve_wait: we detach them first and then act as before.
Resolves bug 264.
svn:r6112
Diffstat (limited to 'src')
-rw-r--r-- | src/or/control.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c index 10e3a80219..f40089cc1a 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1815,7 +1815,9 @@ handle_control_attachstream(connection_t *conn, uint32_t len, return 0; } - if (ap_conn->state != AP_CONN_STATE_CONTROLLER_WAIT) { + if (ap_conn->state != AP_CONN_STATE_CONTROLLER_WAIT && + ap_conn->state != AP_CONN_STATE_CONNECT_WAIT && + ap_conn->state != AP_CONN_STATE_RESOLVE_WAIT) { if (STATE_IS_V0(conn->state)) { send_control0_error(conn, ERR_NO_STREAM, "Connection is not managed by controller."); @@ -1827,6 +1829,17 @@ handle_control_attachstream(connection_t *conn, uint32_t len, return 0; } + /* Do we need to detach it first? */ + if (ap_conn->state != AP_CONN_STATE_CONTROLLER_WAIT) { + circuit_t *circ = circuit_get_by_edge_conn(conn); + connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer); + /* Un-mark it as ending, since we're going to reuse it. */ + conn->has_sent_end = 0; + if (circ) + circuit_detach_stream(circ,conn); + conn->state = AP_CONN_STATE_CONTROLLER_WAIT; + } + if (zero_circ) { connection_ap_handshake_rewrite_and_attach(ap_conn); send_control_done(conn); |