aboutsummaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-02-14 07:53:55 +0000
committerRoger Dingledine <arma@torproject.org>2003-02-14 07:53:55 +0000
commit3cf02a88f49c5fc01fd13fc910c4d5c5ea4ac098 (patch)
tree0c91169c7c95cbb79b9b2ca2451b702f4f39d3cf /src/or/onion.c
parent5273e2b88709feabb34dd9db3cac37854903272b (diff)
downloadtor-3cf02a88f49c5fc01fd13fc910c4d5c5ea4ac098.tar
tor-3cf02a88f49c5fc01fd13fc910c4d5c5ea4ac098.tar.gz
rudimentary dns caching (of both resolves and resolve failures)
serious performance increase over non-caching svn:r158
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index ff708f589..20a256b95 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -9,6 +9,7 @@ extern or_options_t options; /* command-line and config-file options */
static int onion_process(circuit_t *circ);
static int onion_deliver_to_conn(aci_t aci, unsigned char *onion, uint32_t onionlen, connection_t *conn);
+static int find_tracked_onion(unsigned char *onion, uint32_t onionlen);
int decide_aci_type(uint32_t local_addr, uint16_t local_port,
uint32_t remote_addr, uint16_t remote_port) {
@@ -756,7 +757,7 @@ void init_tracked_tree(void) {
/* see if this onion has been seen before. if so, return 1, else
* return 0 and add the sha1 of this onion to the tree.
*/
-int find_tracked_onion(unsigned char *onion, uint32_t onionlen) {
+static int find_tracked_onion(unsigned char *onion, uint32_t onionlen) {
static struct tracked_onion *head_tracked_onions = NULL; /* linked list of tracked onions */
static struct tracked_onion *tail_tracked_onions = NULL;
@@ -764,7 +765,7 @@ int find_tracked_onion(unsigned char *onion, uint32_t onionlen) {
struct tracked_onion *to;
/* first take this opportunity to see if there are any expired
- * onions in the tree. we know this in O(1) because the linked list
+ * onions in the tree. we know this is fast because the linked list
* 'tracked_onions' is ordered by when they were seen.
*/
while(head_tracked_onions && (head_tracked_onions->expire < now)) {