Commit 3d2d8d68 authored by David Goulet's avatar David Goulet 🤘
Browse files

sched: Extra careful in channel_outbuf_length()



In case we don't have a connection object in the channel, just be careful and
recover.
Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 14cd8bdd
......@@ -116,6 +116,12 @@ static scheduler_t *kist_scheduler = NULL;
static inline size_t
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)) {
return 0;
}
return buf_datalen(TO_CONN(BASE_CHAN_TO_TLS(chan)->conn)->outbuf);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment