mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Use event_active, not 0-length timeouts. It's idempotent, too.
This commit is contained in:
parent
fc13184e44
commit
85ee5b3095
@ -117,7 +117,6 @@ static smartlist_t *channels_pending = NULL;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static struct event *run_sched_ev = NULL;
|
static struct event *run_sched_ev = NULL;
|
||||||
static struct timeval run_sched_tv;
|
|
||||||
|
|
||||||
/* Scheduler static function declarations */
|
/* Scheduler static function declarations */
|
||||||
|
|
||||||
@ -300,13 +299,7 @@ static void
|
|||||||
scheduler_retrigger(void)
|
scheduler_retrigger(void)
|
||||||
{
|
{
|
||||||
tor_assert(run_sched_ev);
|
tor_assert(run_sched_ev);
|
||||||
|
event_active(run_sched_ev, EV_TIMEOUT, 1);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Notify the scheduler of a channel being closed */
|
/** Notify the scheduler of a channel being closed */
|
||||||
@ -362,10 +355,7 @@ scheduler_trigger(void)
|
|||||||
|
|
||||||
tor_assert(run_sched_ev);
|
tor_assert(run_sched_ev);
|
||||||
|
|
||||||
run_sched_tv.tv_sec = 0;
|
event_add(run_sched_ev, EV_TIMEOUT, 1);
|
||||||
run_sched_tv.tv_usec = 0;
|
|
||||||
|
|
||||||
evtimer_add(run_sched_ev, &run_sched_tv);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user