Deindent warn_early_consensus()

Remove one level of indentation by returning early from the function.
This commit is contained in:
Taylor Yu 2018-05-03 22:11:44 -05:00
parent 0b80a0e500
commit d6948bc776
1 changed files with 16 additions and 15 deletions

View File

@ -1772,15 +1772,17 @@ STATIC void
warn_early_consensus(const networkstatus_t *c, const char *flavor,
time_t now)
{
/** If a consensus appears more than this many seconds before its declared
* valid-after time, declare that our clock is skewed. */
#define EARLY_CONSENSUS_NOTICE_SKEW 60
if (now < c->valid_after - EARLY_CONSENSUS_NOTICE_SKEW) {
char tbuf[ISO_TIME_LEN+1];
char dbuf[64];
long delta = now - c->valid_after;
char *flavormsg = NULL;
/** If a consensus appears more than this many seconds before its declared
* valid-after time, declare that our clock is skewed. */
#define EARLY_CONSENSUS_NOTICE_SKEW 60
if (now >= c->valid_after - EARLY_CONSENSUS_NOTICE_SKEW)
return;
format_iso_time(tbuf, c->valid_after);
format_time_interval(dbuf, sizeof(dbuf), delta);
log_warn(LD_GENERAL, "Our clock is %s behind the time published in the "
@ -1791,7 +1793,6 @@ warn_early_consensus(const networkstatus_t *c, const char *flavor,
clock_skew_warning(NULL, delta, 1, LD_GENERAL, flavormsg, "CONSENSUS");
tor_free(flavormsg);
}
}
/** Try to replace the current cached v3 networkstatus with the one in
* <b>consensus</b>. If we don't have enough certificates to validate it,