summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-03-24 06:18:59 +0000
committerRoger Dingledine <arma@torproject.org>2005-03-24 06:18:59 +0000
commit09ef2b7e41922a09ab92c1006b8a55b472486ef5 (patch)
tree7a8e9268726e99e0ec700dd0064c0cf43687922f
parent13fdf51bc18428b5cf5e504d61a44f08204d0e22 (diff)
downloadtor-09ef2b7e41922a09ab92c1006b8a55b472486ef5.tar.gz
tor-09ef2b7e41922a09ab92c1006b8a55b472486ef5.zip
cleanup so connection_ap_handshake_attach_chosen_circuit() always
gets open circs. svn:r3856
-rw-r--r--src/or/circuituse.c4
-rw-r--r--src/or/control.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index e9c20f59a8..22b9916818 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -991,9 +991,7 @@ connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
conn->state == AP_CONN_STATE_CONTROLLER_WAIT);
tor_assert(conn->socks_request);
tor_assert(circ);
-
- if (circ->state != CIRCUIT_STATE_OPEN)
- return 0;
+ tor_assert(circ->state == CIRCUIT_STATE_OPEN);
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
diff --git a/src/or/control.c b/src/or/control.c
index 28940e1d4d..47c0cc0e68 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -745,6 +745,10 @@ static int handle_control_attachstream(connection_t *conn, uint32_t len,
send_control_error(conn, ERR_NO_CIRC, "No circuit found with given ID");
return 0;
}
+ if (circ->state != CIRCUIT_STATE_OPEN) {
+ send_control_error(conn, ERR_INTERNAL, "Refuse to attach stream to non-open circ.");
+ return 0;
+ }
if (connection_ap_handshake_attach_chosen_circuit(ap_conn, circ) != 1) {
send_control_error(conn, ERR_INTERNAL, "Unable to attach stream.");
return 0;