diff options
author | David Goulet <dgoulet@torproject.org> | 2018-04-27 11:14:33 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-04-27 11:16:57 -0400 |
commit | 3ab017b10c64e090a5a3f197315ddcdbc6de698c (patch) | |
tree | c601d9bdd87f58caeb5e9ad5fb81d76cf015d910 /src/or/main.c | |
parent | 3a47dfed349ee2c05f30ba142d3583772fa2287f (diff) | |
download | tor-3ab017b10c64e090a5a3f197315ddcdbc6de698c.tar.gz tor-3ab017b10c64e090a5a3f197315ddcdbc6de698c.zip |
main: Don't rescan main loop events if not initialized
This is done because it makes our life easier with unit tests. Also, a rescan
on an uninitialized event list will result in a stacktrace.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index c1103edb3a..10f26c954e 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1553,6 +1553,13 @@ rescan_periodic_events(const or_options_t *options) { tor_assert(options); + /* Avoid scanning the event list if we haven't initialized it yet. This is + * particularly useful for unit tests in order to avoid initializing main + * loop events everytime. */ + if (!periodic_events_initialized) { + return; + } + int roles = get_my_roles(options); for (int i = 0; periodic_events[i].name; ++i) { |