aboutsummaryrefslogtreecommitdiff
path: root/src/or/periodic.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-17 09:26:50 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-17 09:26:50 -0500
commit70f337fdb20f5ce378e1bfb936aa63a40cdcacaa (patch)
tree974a7941340830e510beef8b6d713959f3ca7830 /src/or/periodic.c
parentb91bd27e6f94e76359097e1ec53494ea5168108d (diff)
downloadtor-70f337fdb20f5ce378e1bfb936aa63a40cdcacaa.tar.gz
tor-70f337fdb20f5ce378e1bfb936aa63a40cdcacaa.zip
Some unit tests now require that periodic events be initialized.
Diffstat (limited to 'src/or/periodic.c')
-rw-r--r--src/or/periodic.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/periodic.c b/src/or/periodic.c
index e21b1af37c..109717f738 100644
--- a/src/or/periodic.c
+++ b/src/or/periodic.c
@@ -78,12 +78,11 @@ periodic_event_reschedule(periodic_event_item_t *event)
periodic_event_set_interval(event, 1);
}
-/** Handles initial dispatch for periodic events. It should happen 1 second
- * after the events are created to mimic behaviour before #3199's refactor */
+/** Initializes the libevent backend for a periodic event. */
void
-periodic_event_launch(periodic_event_item_t *event)
+periodic_event_setup(periodic_event_item_t *event)
{
- if (event->ev) { /** Already setup? This is a bug */
+ if (event->ev) { /* Already setup? This is a bug */
log_err(LD_BUG, "Initial dispatch should only be done once.");
tor_assert(0);
}
@@ -93,6 +92,17 @@ periodic_event_launch(periodic_event_item_t *event)
periodic_event_dispatch,
event);
tor_assert(event->ev);
+}
+
+/** Handles initial dispatch for periodic events. It should happen 1 second
+ * after the events are created to mimic behaviour before #3199's refactor */
+void
+periodic_event_launch(periodic_event_item_t *event)
+{
+ if (! event->ev) { /* Not setup? This is a bug */
+ log_err(LD_BUG, "periodic_event_launch without periodic_event_setup");
+ tor_assert(0);
+ }
// Initial dispatch
periodic_event_dispatch(-1, EV_TIMEOUT, event);