[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Bulletproof connection_ap_handshake_attach_chosen_circuit
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv25901/src/or
Modified Files:
circuituse.c
Log Message:
Bulletproof connection_ap_handshake_attach_chosen_circuit
Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- circuituse.c 22 Mar 2005 01:01:15 -0000 1.59
+++ circuituse.c 24 Mar 2005 06:05:14 -0000 1.60
@@ -979,8 +979,8 @@
}
/** Attempt to attach the connection <b>conn</b> to <b>circ</b>, and
- * send a begin or resolve cell as appropriate. Return values for
- * connection_ap_handshake_attach_chosen_circuit. */
+ * send a begin or resolve cell as appropriate. Return values are as
+ * for connection_ap_handshake_attach_circuit. */
int
connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
circuit_t *circ)
@@ -992,6 +992,9 @@
tor_assert(conn->socks_request);
tor_assert(circ);
+ if (circ->state != CIRCUIT_STATE_OPEN)
+ return 0;
+
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
if (!circ->timestamp_dirty)
@@ -1001,9 +1004,11 @@
tor_assert(conn->socks_request);
if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) {
consider_recording_trackhost(conn, circ);
- connection_ap_handshake_send_begin(conn, circ);
+ if (connection_ap_handshake_send_begin(conn, circ)<0)
+ return -1;
} else {
- connection_ap_handshake_send_resolve(conn, circ);
+ if (connection_ap_handshake_send_resolve(conn, circ)<0)
+ return -1;
}
return 1;