aboutsummaryrefslogtreecommitdiff
path: root/src/or/hs_client.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-09-06 11:12:28 -0400
committerGeorge Kadianakis <desnacked@riseup.net>2017-09-08 19:07:00 +0300
commit4d38731e93e927374044fde2730149cb07ac0766 (patch)
tree2b29a13ddf60b76774a0f0b176e6fc1066747f71 /src/or/hs_client.c
parentcd07af60c9e73e16034870ee1d03f729c1f2dd98 (diff)
downloadtor-4d38731e93e927374044fde2730149cb07ac0766.tar.gz
tor-4d38731e93e927374044fde2730149cb07ac0766.zip
prop224: Make client and service pick same HSDir
With the latest change on how we use the HSDir index, the client and service need to pick their responsible HSDir differently that is depending on if they are before or after a new time period. The overlap mode is active function has been renamed for this and test added. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_client.c')
-rw-r--r--src/or/hs_client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index 9f4dba04d4..4f467c7ec6 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -162,6 +162,7 @@ static routerstatus_t *
pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk)
{
int retval;
+ unsigned int is_new_tp = 0;
char base64_blinded_pubkey[ED25519_BASE64_LEN + 1];
uint64_t current_time_period = hs_get_time_period_num(0);
smartlist_t *responsible_hsdirs;
@@ -182,8 +183,9 @@ pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk)
}
/* Get responsible hsdirs of service for this time period */
- hs_get_responsible_hsdirs(&blinded_pubkey, current_time_period, 0, 1,
- responsible_hsdirs);
+ is_new_tp = hs_time_between_tp_and_srv(NULL, time(NULL));
+ hs_get_responsible_hsdirs(&blinded_pubkey, current_time_period,
+ is_new_tp, 1, responsible_hsdirs);
log_debug(LD_REND, "Found %d responsible HSDirs and about to pick one.",
smartlist_len(responsible_hsdirs));