aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-12 11:20:27 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-12 11:20:27 -0400
commitd71a00e91f3921f6bdf160811313e7b32f890b6c (patch)
treeba1eb070b1c764cac2bc0f7507982c56391b2f96 /src/or
parent6c5c74e11e63f8e1a924ac8de4784edaf56179fa (diff)
parent98953b1fc29a693aa797989402f7205523448408 (diff)
downloadtor-d71a00e91f3921f6bdf160811313e7b32f890b6c.tar.gz
tor-d71a00e91f3921f6bdf160811313e7b32f890b6c.zip
Merge remote-tracking branch 'dgoulet/ticket23480_032_01'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/hs_cache.c6
-rw-r--r--src/or/hs_service.c10
-rw-r--r--src/or/nodelist.c6
3 files changed, 14 insertions, 8 deletions
diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c
index 78e2adacf6..7f2a9cbbb7 100644
--- a/src/or/hs_cache.c
+++ b/src/or/hs_cache.c
@@ -234,8 +234,7 @@ cache_clean_v3_as_dir(time_t now, time_t global_cutoff)
/* Logging. */
{
char key_b64[BASE64_DIGEST256_LEN + 1];
- base64_encode(key_b64, sizeof(key_b64), (const char *) key,
- DIGEST256_LEN, 0);
+ digest256_to_base64(key_b64, (const char *) key);
log_info(LD_REND, "Removing v3 descriptor '%s' from HSDir cache",
safe_str_client(key_b64));
}
@@ -655,8 +654,7 @@ cache_clean_v3_as_client(time_t now)
/* Logging. */
{
char key_b64[BASE64_DIGEST256_LEN + 1];
- base64_encode(key_b64, sizeof(key_b64), (const char *) key,
- DIGEST256_LEN, 0);
+ digest256_to_base64(key_b64, (const char *) key);
log_info(LD_REND, "Removing hidden service v3 descriptor '%s' "
"from client cache",
safe_str_client(key_b64));
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index d32a120bc8..05045035f3 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -3023,8 +3023,14 @@ hs_service_lists_fnames_for_sandbox(smartlist_t *file_list,
void
hs_service_dir_info_changed(void)
{
- log_info(LD_REND, "New dirinfo arrived: consider reuploading descriptor");
- consider_republishing_hs_descriptors = 1;
+ if (hs_service_get_num_services() > 0) {
+ /* New directory information usually goes every consensus so rate limit
+ * every 30 minutes to not be too conservative. */
+ static struct ratelim_t dir_info_changed_ratelim = RATELIM_INIT(30 * 60);
+ log_fn_ratelim(&dir_info_changed_ratelim, LOG_INFO, LD_REND,
+ "New dirinfo arrived: consider reuploading descriptor");
+ consider_republishing_hs_descriptors = 1;
+ }
}
/* Called when we get an INTRODUCE2 cell on the circ. Respond to the cell and
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 01a0e9e856..df735a9d24 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -300,14 +300,16 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns)
tor_assert(ns);
if (!networkstatus_is_live(ns, now)) {
- log_info(LD_GENERAL, "Not setting hsdir index with a non-live consensus.");
+ static struct ratelim_t live_consensus_ratelim = RATELIM_INIT(30 * 60);
+ log_fn_ratelim(&live_consensus_ratelim, LOG_INFO, LD_GENERAL,
+ "Not setting hsdir index with a non-live consensus.");
goto done;
}
node_identity_pk = node_get_ed25519_id(node);
if (node_identity_pk == NULL) {
log_debug(LD_GENERAL, "ed25519 identity public key not found when "
- "trying to build the hsdir indexes for node %s",
+ "trying to build the hsdir indexes for node %s",
node_describe(node));
goto done;
}