diff options
author | Taylor Yu <catalyst@torproject.org> | 2018-05-03 22:11:44 -0500 |
---|---|---|
committer | Taylor Yu <catalyst@torproject.org> | 2018-05-08 17:59:03 -0500 |
commit | d6948bc7764dca7644b331aaf37453b328239e6d (patch) | |
tree | e42329990b376e4a6e14f035f110e45e575835b9 /src/or/networkstatus.c | |
parent | 0b80a0e500d5132ca4dd77403b5a4c7f23f26a80 (diff) | |
download | tor-d6948bc7764dca7644b331aaf37453b328239e6d.tar.gz tor-d6948bc7764dca7644b331aaf37453b328239e6d.zip |
Deindent warn_early_consensus()
Remove one level of indentation by returning early from the function.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index ace9fc94a2..d1c2171198 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1772,25 +1772,26 @@ STATIC void warn_early_consensus(const networkstatus_t *c, const char *flavor, time_t now) { + 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; - 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; - 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 " - "consensus network status document (%s UTC). Tor needs an " - "accurate clock to work correctly. Please check your time and " - "date settings!", dbuf, tbuf); - tor_asprintf(&flavormsg, "%s flavor consensus", flavor); - clock_skew_warning(NULL, delta, 1, LD_GENERAL, flavormsg, "CONSENSUS"); - tor_free(flavormsg); - } + 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 " + "consensus network status document (%s UTC). Tor needs an " + "accurate clock to work correctly. Please check your time and " + "date settings!", dbuf, tbuf); + tor_asprintf(&flavormsg, "%s flavor consensus", 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 |