From f816efadc6926aa97b82b26c221b18b682de3d2c Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 23 Dec 2014 19:07:51 +0300 Subject: [PATCH] eitd/sectionsd.cpp: try to fix filter restart on service stop --- src/eitd/dmx.cpp | 2 +- src/eitd/sectionsd.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/eitd/dmx.cpp b/src/eitd/dmx.cpp index e36ada64b..693bc8257 100644 --- a/src/eitd/dmx.cpp +++ b/src/eitd/dmx.cpp @@ -283,7 +283,7 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout lock(); if (!isOpen()) { unlock(); - timeouts = -1; + timeouts = -3; return -1; } diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index a2c06ce43..630a38917 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -972,15 +972,11 @@ static void commandserviceChanged(int connfd, char *data, const unsigned dataLen static void commandserviceStopped(int connfd, char * /* data */, const unsigned /* dataLength */) { xprintf("[sectionsd] commandserviceStopped\n"); - sendEmptyResponse(connfd, NULL, 0); - threadCN.lock(); - threadEIT.lock(); - threadCN.closefd(); - threadEIT.closefd(); - threadCN.unlock(); - threadEIT.unlock(); - threadCN.stopUpdate(); current_channel_id = 0; + sendEmptyResponse(connfd, NULL, 0); + threadEIT.stop(); + threadCN.stop(); + threadCN.stopUpdate(); xprintf("[sectionsd] commandserviceStopped done\n"); } @@ -1585,8 +1581,12 @@ void CSectionThread::run() xprintf("%s: skipping to next filter %d from %d (timeouts %d)\n", name.c_str(), filter_index+1, (int)filters.size(), timeoutsDMX); #endif + if (timeoutsDMX == -3) + sendToSleepNow = true; + else + need_change = true; + timeoutsDMX = 0; - need_change = true; } if (zeit > lastChanged + skipTime) { #ifdef DEBUG_SECTION_THREADS