aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_periodic_event.c
AgeCommit message (Collapse)Author
2022-12-16Fix typosDimitris Apostolou
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-10-27tests: Fix unit tests after adding new HS metrics moduleDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-06-05Run "make autostyle."Nick Mathewson
2019-04-30Rename and clarify some functions for periodic eventsNick Mathewson
When we tell the periodic event manager about an event, we are "registering" that event. The event sits around without being usable, however, until we "connect" the event to libevent. In the end, we "disconnect" the event and remove its libevent parts. Previously, we called these operations "add", "setup", and "destroy", which led to confusion.
2019-04-30Turn 'mainloop' into a subsystem.Nick Mathewson
We need a little refactoring for this to work, since the initialization code for the periodic events assumes that libevent is already initialized, which it can't be until it's configured. This change, combined with the previous ones, lets other subsystems declare their own periodic events, without mainloop.c having to know about them. Implements ticket 30293.
2019-04-25Move the responsibility for listing periodic events to periodic.cNick Mathewson
The end goal here is to move the periodic callback to their respective modules, so that mainloop.c doesn't have to include so many other things. This patch doesn't actually move any of the callbacks out of mainloop.c yet.
2019-01-16Bump copyright date to 2019Nick Mathewson
2018-11-15Make the NET_PARTICIPANT role dependent on user activityNick Mathewson
This patch implements all of 28337, except for the part where we turn off the role if we've been idle for a long time.
2018-11-15Move control_per_second_events() into a callback with its own roleNick Mathewson
Part of making extra-dormant mode work; closes ticket 28421.
2018-11-15Add new "ALL" and "NET_PARTICIPANT" roles for periodic eventsNick Mathewson
The previous "ALL" role was the OR of a bunch of other roles, which is a mistake: it's better if "ALL" means "all". The "NET_PARTICIPANT" role refers to the anything that is actively building circuits, downloading directory information, and participating in the Tor network. For now, it is set to !net_is_disabled(), but we're going to use it to implement a new "extra dormant mode". Closes ticket 28336.
2018-09-27Always initialize the periodic events list.Nick Mathewson
Various places in our code try to activate these events or check their status, so we should make sure they're initialized as early as possible. Fixes bug 27861; bugfix on 0.3.5.1-alpha.
2018-09-21Split main.c into main.c and mainloop.cNick Mathewson
The main.c code is responsible for initialization and shutdown; the mainloop.c code is responsible for running the main loop of Tor. Splitting the "generic event loop" part of mainloop.c from the event-loop-specific part is not done as part of this patch.
2018-08-07Merge branch 'maint-0.3.4'Nick Mathewson
2018-08-02When enabling periodic events, schedule but don't run them immediately.Nick Mathewson
When we fixed 25939 in f7633c1fcaefe72bf97c001bab9062132c919996, we introduced a call to rescan_periodic_events() from inside the onion service logic. But this meant that we could rescan the event list -- thereby running event callbacks! -- from inside the hidden service code. This could cause us to run some of our event callbacks from an inconsistent state, if we were in the middle of changing options. A related bug (#25761) prevented us from rescanning our periodic events as appropriate, but when we fixed THAT one, this bug reared its ugly head. The fix here is that "enabling" an event should cause us to run it from the event loop, but not immediately from the point where we enable it. Fixes bug 27003; bugfix on 0.3.4.1-alpha.
2018-07-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-04-30Make unit tests pass with new dirserver role.Nick Mathewson
2018-04-27test: Unit test for the HS service event rescanDavid Goulet
Because we rescan the main loop event list if the global map of services has changed, this makes sure it does work. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-27hs: Rescan the main loop event list if the service map changesDavid Goulet
Because ADD_ONION/DEL_ONION can modify the global service map (both for v2 and v3), we need to rescan the event list so we either enable or disable the HS service main loop event. Fixees #25939 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-27main: Add mainloop callback event flagsDavid Goulet
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>
2018-04-23test: Add periodic events unit testsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>