mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-03 17:13:33 +01:00
Bulletproof connection_ap_handshake_attach_chosen_circuit
svn:r3855
This commit is contained in:
parent
8fc1061b84
commit
13fdf51bc1
@ -979,8 +979,8 @@ consider_recording_trackhost(connection_t *conn, circuit_t *circ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Attempt to attach the connection <b>conn</b> to <b>circ</b>, and
|
/** Attempt to attach the connection <b>conn</b> to <b>circ</b>, and
|
||||||
* send a begin or resolve cell as appropriate. Return values for
|
* send a begin or resolve cell as appropriate. Return values are as
|
||||||
* connection_ap_handshake_attach_chosen_circuit. */
|
* for connection_ap_handshake_attach_circuit. */
|
||||||
int
|
int
|
||||||
connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
|
connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
|
||||||
circuit_t *circ)
|
circuit_t *circ)
|
||||||
@ -992,6 +992,9 @@ connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
|
|||||||
tor_assert(conn->socks_request);
|
tor_assert(conn->socks_request);
|
||||||
tor_assert(circ);
|
tor_assert(circ);
|
||||||
|
|
||||||
|
if (circ->state != CIRCUIT_STATE_OPEN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
||||||
|
|
||||||
if (!circ->timestamp_dirty)
|
if (!circ->timestamp_dirty)
|
||||||
@ -1001,9 +1004,11 @@ connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
|
|||||||
tor_assert(conn->socks_request);
|
tor_assert(conn->socks_request);
|
||||||
if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) {
|
if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) {
|
||||||
consider_recording_trackhost(conn, circ);
|
consider_recording_trackhost(conn, circ);
|
||||||
connection_ap_handshake_send_begin(conn, circ);
|
if (connection_ap_handshake_send_begin(conn, circ)<0)
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
connection_ap_handshake_send_resolve(conn, circ);
|
if (connection_ap_handshake_send_resolve(conn, circ)<0)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user