From da8fa6a686610eda7388a7a7a16aae558246c8b7 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 13 Aug 2016 00:29:34 +0200 Subject: [PATCH] [cast] Just run empty callback on last request to time out. Running more is unsafe since the first is likely to free the session. --- src/outputs/cast.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/outputs/cast.c b/src/outputs/cast.c index 22cde939..77f5d23e 100644 --- a/src/outputs/cast.c +++ b/src/outputs/cast.c @@ -1205,15 +1205,15 @@ cast_reply_timeout_cb(int fd, short what, void *arg) int i; cs = (struct cast_session *)arg; + i = cs->request_id % CALLBACK_REGISTER_SIZE; - DPRINTF(E_WARN, L_CAST, "Request timeout, will run empty callbacks\n"); + DPRINTF(E_LOG, L_CAST, "Request %d timed out, will run empty callback\n", i); - for (i = 0; i < CALLBACK_REGISTER_SIZE; i++) - if (cs->callback_register[i]) - { - cs->callback_register[i](cs, NULL); - cs->callback_register[i] = NULL; - } + if (cs->callback_register[i]) + { + cs->callback_register[i](cs, NULL); + cs->callback_register[i] = NULL; + } } static void