diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-12-13 03:36:48 -0800 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-12-20 11:15:31 -0500 |
commit | 46783eb6d7f6668ccfad6c4c44021e606cccdbcb (patch) | |
tree | 5b2f2975aa1db26a60183dbf2c62ac25a18c922f /src/or/rendservice.c | |
parent | 37504b5efae2e1423ec09eae6fc6d1e229987e3d (diff) | |
download | tor-46783eb6d7f6668ccfad6c4c44021e606cccdbcb.tar.gz tor-46783eb6d7f6668ccfad6c4c44021e606cccdbcb.zip |
Extract function to determine how many intros an intro point has handled
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r-- | src/or/rendservice.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 177f3bf23c..0f22cdfe2b 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -28,6 +28,7 @@ static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro, const char *pk_digest); static rend_intro_point_t *find_intro_point(origin_circuit_t *circ); +static int intro_point_accepted_intro_count(rend_intro_point_t *intro); static int intro_point_should_expire_now(rend_intro_point_t *intro, time_t now); @@ -1937,6 +1938,18 @@ upload_service_descriptor(rend_service_t *service) service->desc_is_dirty = 0; } +/** Return the number of INTRODUCE2 cells an intro point has + * received. */ +static int +intro_point_accepted_intro_count(rend_intro_point_t *intro) +{ + if (intro->accepted_intro_rsa_parts == NULL) { + return 0; + } else { + return digestmap_size(intro->accepted_intro_rsa_parts); + } +} + /** Return non-zero iff <b>intro</b> should 'expire' now (i.e. we * should stop publishing it in new descriptors and eventually close * it). */ @@ -1957,8 +1970,7 @@ intro_point_should_expire_now(rend_intro_point_t *intro, return 1; } - if (intro->accepted_intro_rsa_parts != NULL && - digestmap_size(intro->accepted_intro_rsa_parts) >= + if (intro_point_accepted_intro_count(intro) >= INTRO_POINT_LIFETIME_INTRODUCTIONS) { /* This intro point has been used too many times. Expire it now. */ return 1; |