diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-14 14:22:22 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-15 11:40:59 -0400 |
commit | 14cd8bdd4ba6f4c5946ecd9877c77c9ba305bbe8 (patch) | |
tree | 1c76e5bfe124d06d7e68582b7f644ad843066c83 /src/or/scheduler_kist.c | |
parent | 84d18f70f3400df3e9c3b3c47288e82cd9160f6e (diff) | |
download | tor-14cd8bdd4ba6f4c5946ecd9877c77c9ba305bbe8.tar.gz tor-14cd8bdd4ba6f4c5946ecd9877c77c9ba305bbe8.zip |
sched: Don't expose the global scheduler libevent object
Instead, add wrappers to do the needed action the different scheduler needs
with the libevent object.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index 8646169ee3..b4234a053b 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -471,14 +471,7 @@ kist_scheduler_schedule(void) struct monotime_t now; struct timeval next_run; int32_t diff; - struct event *ev = get_run_sched_ev(); - IF_BUG_ONCE(!ev) { - log_warn(LD_SCHED, "Wow we don't have a scheduler event. That's really " - "weird! We can't really schedule a scheduling run with libevent " - "without it. So we're going to stop trying now and hope we have " - "one next time. If we never get one, we're broken."); - return; - } + if (!have_work()) { return; } @@ -489,9 +482,9 @@ kist_scheduler_schedule(void) /* 1000 for ms -> us */ next_run.tv_usec = (sched_run_interval - diff) * 1000; /* Readding an event reschedules it. It does not duplicate it. */ - event_add(ev, &next_run); + scheduler_ev_add(&next_run); } else { - event_active(ev, EV_TIMEOUT, 1); + scheduler_ev_active(EV_TIMEOUT); } } |