aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2015-11-18 11:27:24 +0000
committerYawning Angel <yawning@schwanenlied.me>2015-11-18 11:31:05 +0000
commit85bb71049ac582e886144fd74fb869f4c7bdc5a8 (patch)
tree55c4c3993061a5a67793197998f967b8ba619edb /src/or/main.c
parent8af5afedc92cca81ec8132baa1ec7d801145d011 (diff)
downloadtor-85bb71049ac582e886144fd74fb869f4c7bdc5a8.tar.gz
tor-85bb71049ac582e886144fd74fb869f4c7bdc5a8.zip
Fix a startup time assert caused by periodic events not being initialized.
Loading a on disk bridge descriptor causes a directory download to be scheduled, which asserts due to the periodic events not being initialized yet. Fixes bug #17635, not in any released version of tor.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 0b8591f1d4..7aeacd138d 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2299,6 +2299,13 @@ do_main_loop(void)
{
time_t now;
+ /* initialize the periodic events first, so that code that depends on the
+ * events being present does not assert.
+ */
+ if (! periodic_events_initialized) {
+ initialize_periodic_events();
+ }
+
/* initialize dns resolve map, spawn workers if needed */
if (dns_init() < 0) {
if (get_options()->ServerDNSAllowBrokenConfig)
@@ -2401,10 +2408,6 @@ do_main_loop(void)
tor_assert(second_timer);
}
- if (! periodic_events_initialized) {
- initialize_periodic_events();
- }
-
#ifdef HAVE_SYSTEMD_209
uint64_t watchdog_delay;
/* set up systemd watchdog notification. */