Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodic refactor squashed #993

Merged
7 commits merged into from Apr 30, 2019

Conversation

nmathewson
Copy link
Contributor

No description provided.

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.
We have checks in various places in mainlook.c to make sure that
events are initialized before we invoke any periodic_foo() functions
on them.  But now that each subsystem will own its own periodic
events, it will be cleaner if we don't assume that they are all
setup or not.
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.
This is now the responsibility of the mainloop's subsystem initializer.
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.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4898

  • 82 of 124 (66.13%) changed or added relevant lines in 5 files are covered.
  • 42 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.04%) to 62.222%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/core/mainloop/mainloop.c 12 18 66.67%
src/core/mainloop/periodic.c 48 60 80.0%
src/feature/dirauth/dirauth_periodic.c 10 34 29.41%
Files with Coverage Reduction New Missed Lines %
src/core/or/relay.c 1 49.33%
src/feature/stats/rephist.c 4 43.28%
src/core/mainloop/mainloop.c 16 32.33%
src/core/mainloop/periodic.c 21 62.6%
Totals Coverage Status
Change from base Build 4883: -0.04%
Covered Lines: 46216
Relevant Lines: 74276

💛 - Coveralls

@ghost ghost merged commit b7cc631 into torproject:master Apr 30, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants