diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-18 10:58:38 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-18 10:58:38 -0400 |
commit | c7af923567bca5b0a6e9dcd5ceda4b01be09f9a1 (patch) | |
tree | 2b95be2cbd19b38ea7a31cf07849f6f633b28168 /src/or/scheduler.c | |
parent | 77cc97cf0a20ed0a062a1cb87bef6c40941e4cff (diff) | |
download | tor-c7af923567bca5b0a6e9dcd5ceda4b01be09f9a1.tar.gz tor-c7af923567bca5b0a6e9dcd5ceda4b01be09f9a1.zip |
sched: BUG() on event_add() and log_warn next_run
It is highly unlikely to happen but if so, we need to know and why. The
warning with the next_run values could help.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler.c')
-rw-r--r-- | src/or/scheduler.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c index 2d6f7fc4bd..43fff2bf2b 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -506,7 +506,11 @@ scheduler_ev_add(const struct timeval *next_run) { tor_assert(run_sched_ev); tor_assert(next_run); - event_add(run_sched_ev, next_run); + if (BUG(event_add(run_sched_ev, next_run) < 0)) { + log_warn(LD_SCHED, "Adding to libevent failed. Next run time was set to: " + "%ld.%06ld", next_run->tv_sec, next_run->tv_usec); + return; + } } /* Make the scheduler event active with the given flags. */ |