From 05d314f888dd96840d92fbcc513974487485f4cb Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 26 Apr 2018 14:20:31 -0400 Subject: 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 --- src/test/test_periodic_event.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/test/test_periodic_event.c') 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 -- cgit v1.2.3-54-g00ecf