summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-21 10:58:06 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-21 10:58:06 -0400
commit4c7a89a226be2f75400f3fc22d19ec9c31acd891 (patch)
tree67f1a0aafd41fc063a835bf33ed65501ca6f278a /src
parent0f6bbbc74bef96a71480e0d59fb3e1a89c14a950 (diff)
parentad814cad41a101a3afd03ed0fdc55e2efd696abf (diff)
downloadtor-4c7a89a226be2f75400f3fc22d19ec9c31acd891.tar.gz
tor-4c7a89a226be2f75400f3fc22d19ec9c31acd891.zip
Merge remote-tracking branch 'catalyst-oniongit/bug23607'
Diffstat (limited to 'src')
-rw-r--r--src/or/statefile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c
index 9647aa8834..2d579a0220 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -34,6 +34,7 @@
#include "config.h"
#include "confparse.h"
#include "connection.h"
+#include "control.h"
#include "entrynodes.h"
#include "hibernate.h"
#include "rephist.h"
@@ -404,10 +405,15 @@ or_state_load(void)
log_info(LD_GENERAL, "Loaded state from \"%s\"", fname);
/* Warn the user if their clock has been set backwards,
* they could be tricked into using old consensuses */
- time_t apparent_skew = new_state->LastWritten - time(NULL);
- if (apparent_skew > 0)
+ time_t apparent_skew = time(NULL) - new_state->LastWritten;
+ if (apparent_skew < 0) {
+ /* Initialize bootstrap event reporting because we might call
+ * clock_skew_warning() before the bootstrap state is
+ * initialized, causing an asserttion failure. */
+ control_event_bootstrap(BOOTSTRAP_STATUS_STARTING, 0);
clock_skew_warning(NULL, (long)apparent_skew, 1, LD_GENERAL,
"local state file", fname);
+ }
} else {
log_info(LD_GENERAL, "Initialized state");
}