diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-12-22 07:15:24 -0800 |
---|---|---|
committer | Robert Ransom <rransom.8774@gmail.com> | 2011-12-22 23:46:09 -0800 |
commit | 4c3a23b283774f02fbc35f70c72256c6469071d3 (patch) | |
tree | 6888a3030d50cd73141d9a3176adf7190a911646 /src/or/circuitlist.c | |
parent | 66f77561c0bb93bf768b2764137ab1b5e4fc04a4 (diff) | |
download | tor-4c3a23b283774f02fbc35f70c72256c6469071d3.tar.gz tor-4c3a23b283774f02fbc35f70c72256c6469071d3.zip |
Look up the rend circ whose INTRODUCE1 is being ACKed correctly
This change cannibalizes circuit_get_by_rend_query_and_purpose because it
had exactly one caller.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 25b80f11f3..350d8edc0a 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -873,26 +873,30 @@ circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason) } } -/** Return a circ such that: - * - circ-\>rend_data-\>onion_address is equal to <b>rend_query</b>, and - * - circ-\>purpose is equal to <b>purpose</b>. +/** Return a circ such that + * - circ-\>rend_data-\>onion_address is equal to + * <b>rend_data</b>-\>onion_address, + * - circ-\>rend_data-\>rend_cookie is equal to + * <b>rend_data</b>-\>rend_cookie, and + * - circ-\>purpose is equal to CIRCUIT_PURPOSE_C_REND_READY. * * Return NULL if no such circuit exists. */ origin_circuit_t * -circuit_get_by_rend_query_and_purpose(const char *rend_query, uint8_t purpose) +circuit_get_ready_rend_circ_by_rend_data(const rend_data_t *rend_data) { circuit_t *circ; - tor_assert(CIRCUIT_PURPOSE_IS_ORIGIN(purpose)); - for (circ = global_circuitlist; circ; circ = circ->next) { if (!circ->marked_for_close && - circ->purpose == purpose) { + circ->purpose == CIRCUIT_PURPOSE_C_REND_READY) { origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); if (ocirc->rend_data && - !rend_cmp_service_ids(rend_query, - ocirc->rend_data->onion_address)) + !rend_cmp_service_ids(rend_data->onion_address, + ocirc->rend_data->onion_address) && + tor_memeq(ocirc->rend_data->rend_cookie, + rend_data->rend_cookie, + REND_COOKIE_LEN)) return ocirc; } } |