hs-v3: Rate limit some log statements

Also fix an indentation issue.

Closes #23480

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2017-09-12 11:02:40 -04:00
parent 184bd22586
commit 98953b1fc2
2 changed files with 12 additions and 4 deletions

View File

@ -2978,9 +2978,15 @@ 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");
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
* launch a circuit to the rendezvous point. */

View File

@ -300,7 +300,9 @@ 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;
}