diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-09-08 19:06:20 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-08 19:07:00 +0300 |
commit | e7bdb9eedce5edd014090883c222eb474648a87b (patch) | |
tree | 0e79177d9cc25296ef1c6483096f6338528389c6 /src/or | |
parent | eb81a8e69c654abc0830ce76899945235cf09d7d (diff) | |
download | tor-e7bdb9eedce5edd014090883c222eb474648a87b.tar.gz tor-e7bdb9eedce5edd014090883c222eb474648a87b.zip |
prop224: hs_time_between_tp_and_srv() -> hs_in_period_between_tp_and_srv()
Conflicts:
src/or/nodelist.c
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/hs_client.c | 2 | ||||
-rw-r--r-- | src/or/hs_common.c | 2 | ||||
-rw-r--r-- | src/or/hs_common.h | 2 | ||||
-rw-r--r-- | src/or/hs_service.c | 4 | ||||
-rw-r--r-- | src/or/nodelist.c | 7 |
5 files changed, 9 insertions, 8 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c index 4f467c7ec6..c9709b4d2d 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -183,7 +183,7 @@ pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk) } /* Get responsible hsdirs of service for this time period */ - is_new_tp = hs_time_between_tp_and_srv(NULL, time(NULL)); + is_new_tp = hs_in_period_between_tp_and_srv(NULL, time(NULL)); hs_get_responsible_hsdirs(&blinded_pubkey, current_time_period, is_new_tp, 1, responsible_hsdirs); diff --git a/src/or/hs_common.c b/src/or/hs_common.c index e5ea379540..291d8ae8da 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -1049,7 +1049,7 @@ hs_build_blinded_keypair(const ed25519_keypair_t *kp, * +------------------------------------------------------------------+ */ MOCK_IMPL(int, -hs_time_between_tp_and_srv, (const networkstatus_t *consensus, time_t now)) +hs_in_period_between_tp_and_srv,(const networkstatus_t *consensus, time_t now)) { time_t valid_after; time_t srv_start_time, tp_start_time; diff --git a/src/or/hs_common.h b/src/or/hs_common.h index b2e3c836d2..77b4e6544b 100644 --- a/src/or/hs_common.h +++ b/src/or/hs_common.h @@ -204,7 +204,7 @@ time_t hs_get_start_time_of_next_time_period(time_t now); link_specifier_t *hs_link_specifier_dup(const link_specifier_t *lspec); -MOCK_DECL(int, hs_time_between_tp_and_srv, +MOCK_DECL(int, hs_in_period_between_tp_and_srv, (const networkstatus_t *consensus, time_t now)); uint8_t *hs_get_current_srv(uint64_t time_period_num, diff --git a/src/or/hs_service.c b/src/or/hs_service.c index 41154d270e..8f5da2b634 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -1398,7 +1398,7 @@ build_descriptors_for_new_service(hs_service_t *service, time_t now) * TP#1 and next TP#2. */ - if (hs_time_between_tp_and_srv(NULL, now)) { + if (hs_in_period_between_tp_and_srv(NULL, now)) { /* Case B from the above, inside of the new time period. */ current_desc_tp = hs_get_previous_time_period_num(0); /* TP#1 */ next_desc_tp = hs_get_time_period_num(0); /* TP#2 */ @@ -2390,7 +2390,7 @@ upload_descriptor_to_all(const hs_service_t *service, /* Do we have a new TP that is are we between a new time period and the next * SRV creation? */ - is_new_tp = hs_time_between_tp_and_srv(NULL, approx_time()); + is_new_tp = hs_in_period_between_tp_and_srv(NULL, approx_time()); /* Get our list of responsible HSDir. */ responsible_dirs = smartlist_new(); /* The parameter 0 means that we aren't a client so tell the function to use diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 674533b222..29ef835fba 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -210,7 +210,8 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns) /* We always use the current time period for fetching descs */ fetch_tp = current_time_period_num; - if (hs_time_between_tp_and_srv(ns, now)) { + /* Now extract the needed SRVs and time periods for building hsdir indices */ + if (hs_in_period_between_tp_and_srv(ns, now)) { fetch_srv = hs_get_current_srv(fetch_tp, ns); store_first_tp = hs_get_previous_time_period_num(0); @@ -233,7 +234,7 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns) /* If we are in the time segment between SRV#N and TP#N, the fetch index is the same as the first store index */ - if (!hs_time_between_tp_and_srv(ns, now)) { + if (!hs_in_period_between_tp_and_srv(ns, now)) { memcpy(node->hsdir_index->store_first, node->hsdir_index->fetch, sizeof(node->hsdir_index->store_first)); } else { @@ -243,7 +244,7 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns) /* If we are in the time segment between TP#N and SRV#N+1, the fetch index is the same as the second store index */ - if (hs_time_between_tp_and_srv(ns, now)) { + if (hs_in_period_between_tp_and_srv(ns, now)) { memcpy(node->hsdir_index->store_second, node->hsdir_index->fetch, sizeof(node->hsdir_index->store_second)); } else { |