summaryrefslogtreecommitdiff
path: root/src/or/periodic.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-02 15:36:09 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-13 16:25:40 -0500
commitdd00fd0a1f3d9c30d94c00ce7f847298b4494c7d (patch)
treefd2d79998b301fab0313962e55dc00f0365c740a /src/or/periodic.h
parent65a6489e5e52ff9b80e10e5fdea0cdd3e1097810 (diff)
downloadtor-dd00fd0a1f3d9c30d94c00ce7f847298b4494c7d.tar.gz
tor-dd00fd0a1f3d9c30d94c00ce7f847298b4494c7d.zip
Change periodic.c to use libevent directly
Libevent's periodic timers aren't the right solution when the timeout potentially changes every time.
Diffstat (limited to 'src/or/periodic.h')
-rw-r--r--src/or/periodic.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/periodic.h b/src/or/periodic.h
index 2ab3db00a5..e57666c0c8 100644
--- a/src/or/periodic.h
+++ b/src/or/periodic.h
@@ -13,18 +13,19 @@
typedef int (*periodic_event_helper_t)(time_t now,
const or_options_t *options);
+struct event;
+
/** A single item for the periodic-events-function table. */
typedef struct periodic_event_item_t {
periodic_event_helper_t fn; /**< The function to run the event */
- int interval; /**< The interval for running the function (In seconds). */
time_t last_action_time; /**< The last time the function did something */
- periodic_timer_t *timer; /**< Timer object for this event */
+ struct event *ev; /**< Libevent callback we're using to implement this */
const char *name; /**< Name of the function -- for debug */
} periodic_event_item_t;
/** events will get their interval from first execution */
-#define PERIODIC_EVENT(fn) { fn##_callback, 0, 0, NULL, #fn }
-#define END_OF_PERIODIC_EVENTS { NULL, 0, 0, NULL, NULL }
+#define PERIODIC_EVENT(fn) { fn##_callback, 0, NULL, #fn }
+#define END_OF_PERIODIC_EVENTS { NULL, 0, NULL, NULL }
void periodic_event_launch(periodic_event_item_t *event);
void periodic_event_destroy(periodic_event_item_t *event);