[cast] Just run empty callback on last request to time out. Running more is unsafe since the first is likely to free the session.

This commit is contained in:
ejurgensen 2016-08-13 00:29:34 +02:00
parent 61457f2a09
commit da8fa6a686

View File

@ -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