aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-04 13:50:24 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-04 13:50:24 -0500
commit65420e4cb5edcd02b6f44462dcc5c3a7fa8bb2e9 (patch)
tree86e7a09ba27884359051963eb4097cc3a353413a /src/or/circuitlist.c
parent47b7a279298c81137430527ed0a72c6a6d3fcd61 (diff)
parent0bd53b8d87a5fd4691530b8cb54181037062b949 (diff)
downloadtor-65420e4cb5edcd02b6f44462dcc5c3a7fa8bb2e9.tar.gz
tor-65420e4cb5edcd02b6f44462dcc5c3a7fa8bb2e9.zip
Merge remote-tracking branch 'rransom-tor/bug1297b-v2'
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 4fa1888305..97b6162606 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -930,26 +930,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;
}
}