diff options
author | David Goulet <dgoulet@torproject.org> | 2018-04-26 14:20:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-27 09:28:00 -0400 |
commit | 05d314f888dd96840d92fbcc513974487485f4cb (patch) | |
tree | b4f8c5d28bbedab890475bbdbd4fe517c7f6cac1 /src/test | |
parent | 302908657f492f064f9bddac794db477f53ab958 (diff) | |
download | tor-05d314f888dd96840d92fbcc513974487485f4cb.tar.gz tor-05d314f888dd96840d92fbcc513974487485f4cb.zip |
main: Add mainloop callback event flags
Implement the ability to set flags per events which influences the set up of
the event.
This commit only adds one flag which is "need network" meaning that the event
is not enabled if tor has disabled the network or if hibernation mode.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_periodic_event.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test_periodic_event.c b/src/test/test_periodic_event.c index 1a9f4351ea..bebbb5e584 100644 --- a/src/test/test_periodic_event.c +++ b/src/test/test_periodic_event.c @@ -16,6 +16,7 @@ #include "or.h" #include "config.h" +#include "hibernate.h" #include "hs_service.h" #include "main.h" #include "periodic.h" @@ -74,6 +75,9 @@ test_pe_launch(void *arg) (void) arg; hs_init(); + /* We need to put tor in hibernation live state so the events requiring + * network gets enabled. */ + consider_hibernation(time(NULL)); /* Hack: We'll set a dumb fn() of each events so they don't get called when * dispatching them. We just want to test the state of the callbacks, not |