aboutsummaryrefslogtreecommitdiff
path: root/src/or/scheduler_kist.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-10-03 14:38:30 -0400
committerNick Mathewson <nickm@torproject.org>2017-11-02 10:30:33 -0400
commit3931a6f264355d7fe017219f76bd5bec1d8bcbd8 (patch)
tree35750425f43f95761ec7110d974099fe25a9a36d /src/or/scheduler_kist.c
parent2e8de0de3b5ae10277cd0fd72e782d2f6aa30c81 (diff)
downloadtor-3931a6f264355d7fe017219f76bd5bec1d8bcbd8.tar.gz
tor-3931a6f264355d7fe017219f76bd5bec1d8bcbd8.zip
sched: Use SCHED_BUG() macro in scheduler
When a BUG() occurs, this macro will print extra information about the state of the scheduler and the given channel if any. This will help us greatly to fix future bugs in the scheduler especially when they occur rarely. Fixes #23753 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r--src/or/scheduler_kist.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index d269fb49b8..ea6910c702 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -116,7 +116,7 @@ channel_outbuf_length(channel_t *chan)
/* In theory, this can not happen because we can not scheduler a channel
* without a connection that has its outbuf initialized. Just in case, bug
* on this so we can understand a bit more why it happened. */
- if (BUG(BASE_CHAN_TO_TLS(chan)->conn == NULL)) {
+ if (SCHED_BUG(BASE_CHAN_TO_TLS(chan)->conn == NULL, chan)) {
return 0;
}
return buf_datalen(TO_CONN(BASE_CHAN_TO_TLS(chan)->conn)->outbuf);
@@ -370,7 +370,7 @@ socket_can_write(socket_table_t *table, const channel_t *chan)
{
socket_table_ent_t *ent = NULL;
ent = socket_table_search(table, chan);
- IF_BUG_ONCE(!ent) {
+ if (SCHED_BUG(!ent, chan)) {
return 1; // Just return true, saying that kist wouldn't limit the socket
}
@@ -390,7 +390,7 @@ update_socket_info(socket_table_t *table, const channel_t *chan)
{
socket_table_ent_t *ent = NULL;
ent = socket_table_search(table, chan);
- IF_BUG_ONCE(!ent) {
+ if (SCHED_BUG(!ent, chan)) {
return; // Whelp. Entry didn't exist for some reason so nothing to do.
}
update_socket_info_impl(ent);
@@ -402,7 +402,7 @@ update_socket_written(socket_table_t *table, channel_t *chan, size_t bytes)
{
socket_table_ent_t *ent = NULL;
ent = socket_table_search(table, chan);
- IF_BUG_ONCE(!ent) {
+ if (SCHED_BUG(!ent, chan)) {
return; // Whelp. Entry didn't exist so nothing to do.
}