aboutsummaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-09-27 11:54:36 -0400
committerNick Mathewson <nickm@torproject.org>2014-02-13 14:44:43 -0500
commit8b9a2cb68b290e550695124d7ef0511225b451d5 (patch)
tree13c3ce9603acf7f1168221df432479097fbfd3ea /src/or/or.h
parent7f6aa780e3183f34b2fa771e17813018e6b28115 (diff)
downloadtor-8b9a2cb68b290e550695124d7ef0511225b451d5.tar
tor-8b9a2cb68b290e550695124d7ef0511225b451d5.tar.gz
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/or.h')
-rw-r--r--src/or/or.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/or/or.h b/src/or/or.h
index 5318b0fe5..510b8eaa5 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -99,6 +99,7 @@
#include "ht.h"
#include "replaycache.h"
#include "crypto_curve25519.h"
+#include "tor_queue.h"
/* These signals are defined to help handle_control_signal work.
*/
@@ -3152,20 +3153,8 @@ typedef struct or_circuit_t {
* is not marked for close. */
struct or_circuit_t *rend_splice;
-#if REND_COOKIE_LEN >= DIGEST_LEN
-#define REND_TOKEN_LEN REND_COOKIE_LEN
-#else
-#define REND_TOKEN_LEN DIGEST_LEN
-#endif
+ struct or_circuit_rendinfo_s *rendinfo;
- /** A hash of location-hidden service's PK if purpose is INTRO_POINT, or a
- * rendezvous cookie if purpose is REND_POINT_WAITING. Filled with zeroes
- * otherwise.
- * ???? move to a subtype or adjunct structure? Wastes 20 bytes. -NM
- */
- char rend_token[REND_TOKEN_LEN];
-
- /* ???? move to a subtype or adjunct structure? Wastes 20 bytes -NM */
/** Stores KH for the handshake. */
char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
@@ -3186,6 +3175,25 @@ typedef struct or_circuit_t {
uint64_t total_cell_waiting_time;
} or_circuit_t;
+typedef struct or_circuit_rendinfo_s {
+
+#if REND_COOKIE_LEN != DIGEST_LEN
+#error "The REND_TOKEN_LEN macro assumes REND_COOKIE_LEN == DIGEST_LEN"
+#endif
+#define REND_TOKEN_LEN DIGEST_LEN
+
+ /** A hash of location-hidden service's PK if purpose is INTRO_POINT, or a
+ * rendezvous cookie if purpose is REND_POINT_WAITING. Filled with zeroes
+ * otherwise.
+ */
+ char rend_token[REND_TOKEN_LEN];
+
+ /** True if this is a rendezvous point circuit; false if this is an
+ * introduction point. */
+ unsigned is_rend_circ;
+
+} or_circuit_rendinfo_t;
+
/** Convert a circuit subtype to a circuit_t. */
#define TO_CIRCUIT(x) (&((x)->base_))