commit 85ee5b3095f60052412a0bbb1ef0a4ccd5b7c97e Author: Nick Mathewson nickm@torproject.org Date: Mon Oct 14 13:17:11 2013 -0400
Use event_active, not 0-length timeouts. It's idempotent, too. --- src/or/scheduler.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/or/scheduler.c b/src/or/scheduler.c index d965f3b..e2dcdb5 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -117,7 +117,6 @@ static smartlist_t *channels_pending = NULL; */
static struct event *run_sched_ev = NULL; -static struct timeval run_sched_tv;
/* Scheduler static function declarations */
@@ -300,13 +299,7 @@ static void scheduler_retrigger(void) { tor_assert(run_sched_ev); - - if (!evtimer_pending(run_sched_ev, NULL)) { - log_debug(LD_SCHED, "Retriggering scheduler event"); - - event_del(run_sched_ev); - evtimer_add(run_sched_ev, &run_sched_tv); - } + event_active(run_sched_ev, EV_TIMEOUT, 1); }
/** Notify the scheduler of a channel being closed */ @@ -362,10 +355,7 @@ scheduler_trigger(void)
tor_assert(run_sched_ev);
- run_sched_tv.tv_sec = 0; - run_sched_tv.tv_usec = 0; - - evtimer_add(run_sched_ev, &run_sched_tv); + event_add(run_sched_ev, EV_TIMEOUT, 1); } #endif
tor-commits@lists.torproject.org