diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-27 11:54:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-13 14:44:43 -0500 |
commit | 8b9a2cb68b290e550695124d7ef0511225b451d5 (patch) | |
tree | 13c3ce9603acf7f1168221df432479097fbfd3ea /src/or/rendmid.c | |
parent | 7f6aa780e3183f34b2fa771e17813018e6b28115 (diff) | |
download | tor-8b9a2cb68b290e550695124d7ef0511225b451d5.tar.gz tor-8b9a2cb68b290e550695124d7ef0511225b451d5.zip |
Faster circuit_get_by_rend_token_and_purpose()
On busy servers, this function takes up something like 3-7% in
different profiles, and gets invoked every time we need to participate
as the midpoint in a hidden service.
So maybe walking through a linked list of all the circuits here wasn't
a good idea.
Diffstat (limited to 'src/or/rendmid.c')
-rw-r--r-- | src/or/rendmid.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/rendmid.c b/src/or/rendmid.c index 1bd11f6dc0..8090bf2d8e 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -111,7 +111,7 @@ rend_mid_establish_intro(or_circuit_t *circ, const uint8_t *request, /* Now, set up this circuit. */ circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_INTRO_POINT); - memcpy(circ->rend_token, pk_digest, DIGEST_LEN); + circuit_set_intro_point_digest(circ, (uint8_t *)pk_digest); log_info(LD_REND, "Established introduction point on circuit %u for service %s", @@ -251,7 +251,7 @@ rend_mid_establish_rendezvous(or_circuit_t *circ, const uint8_t *request, } circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_REND_POINT_WAITING); - memcpy(circ->rend_token, request, REND_COOKIE_LEN); + circuit_set_rendezvous_cookie(circ, request); base16_encode(hexid,9,(char*)request,4); @@ -327,7 +327,7 @@ rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request, circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_REND_ESTABLISHED); circuit_change_purpose(TO_CIRCUIT(rend_circ), CIRCUIT_PURPOSE_REND_ESTABLISHED); - memset(circ->rend_token, 0, REND_COOKIE_LEN); + circuit_set_rendezvous_cookie(circ, NULL); rend_circ->rend_splice = circ; circ->rend_splice = rend_circ; |