aboutsummaryrefslogtreecommitdiff
path: root/src/or/scheduler_vanilla.c
diff options
context:
space:
mode:
authorMatt Traudt <sirmatt@ksu.edu>2017-09-13 16:35:15 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-15 11:40:59 -0400
commit6ff8c86ac663914901b4ea9ce64c20b59bec6011 (patch)
tree50e4097cc0e3462bc8a06e524ac3d45df08ca303 /src/or/scheduler_vanilla.c
parent4bc97c6431a7609cd7e2f5b27238338bc9d2c7cd (diff)
downloadtor-6ff8c86ac663914901b4ea9ce64c20b59bec6011.tar.gz
tor-6ff8c86ac663914901b4ea9ce64c20b59bec6011.zip
sched: change most asserts to non-fatal BUGs
Diffstat (limited to 'src/or/scheduler_vanilla.c')
-rw-r--r--src/or/scheduler_vanilla.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/or/scheduler_vanilla.c b/src/or/scheduler_vanilla.c
index d35b48c745..efc0e98de2 100644
--- a/src/or/scheduler_vanilla.c
+++ b/src/or/scheduler_vanilla.c
@@ -29,7 +29,9 @@ static int
have_work(void)
{
smartlist_t *cp = get_channels_pending();
- tor_assert(cp);
+ IF_BUG_ONCE(!cp) {
+ return 0; // channels_pending doesn't exist so... no work?
+ }
return smartlist_len(cp) > 0;
}
@@ -42,7 +44,13 @@ vanilla_scheduler_schedule(void)
return;
}
struct event *ev = get_run_sched_ev();
- tor_assert(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;
+ }
event_active(ev, EV_TIMEOUT, 1);
}
@@ -64,7 +72,12 @@ vanilla_scheduler_run(void)
chan = smartlist_pqueue_pop(cp,
scheduler_compare_channels,
offsetof(channel_t, sched_heap_idx));
- tor_assert(chan);
+ IF_BUG_ONCE(!chan) {
+ /* Some-freaking-how a NULL got into the channels_pending. That should
+ * never happen, but it should be harmless to ignore it and keep looping.
+ */
+ continue;
+ }
/* Figure out how many cells we can write */
n_cells = channel_num_cells_writeable(chan);