From a0cefea55a4e57ea38c9c273f4df29320c8b85c5 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 17 Feb 2013 17:36:19 +0100 Subject: [PATCH] sectionsd: retry getting eit_version Sometimes at first start, the cn thread does not fetch the EIT version and thus automatic updates don't work. The cause of this is not 100% clear, for now let's add a workaround to try a bit longer fetching it. Signed-off-by: Jacek Jendrzej --- src/eitd/eitd.h | 2 ++ src/eitd/sectionsd.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/eitd/eitd.h b/src/eitd/eitd.h index 31858afe2..e0aead9c3 100644 --- a/src/eitd/eitd.h +++ b/src/eitd/eitd.h @@ -244,6 +244,7 @@ class CCNThread : public CEventsThread private: /* overloaded hooks */ void addFilters(); + bool shouldSleep(); void beforeSleep(); void beforeWait(); void afterWait(); @@ -254,6 +255,7 @@ class CCNThread : public CEventsThread OpenThreads::Mutex update_mutex; bool updating; cDemux * eitDmx; + int eit_retry; void sendCNEvent(); public: diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index fe421da58..7a81ff341 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1575,6 +1575,23 @@ bool CEventsThread::addEvents() return true; } +bool CCNThread::shouldSleep() +{ + if (!scanning || channel_is_blacklisted) + return true; + if (!sendToSleepNow) + return false; + if (eit_version != 0xff) + return true; + + if (++eit_retry > 1) { + xprintf("%s::%s eit_retry > 1 (%d) -> going to sleep\n", name.c_str(), __func__, eit_retry); + return true; + } + sendToSleepNow = false; + return false; +} + /* default check if thread should go to sleep */ bool CEventsThread::shouldSleep() { @@ -1648,6 +1665,7 @@ CCNThread::CCNThread() updating = false; eitDmx = new cDemux(0); + eit_retry = 0; } /* CN thread hooks */ @@ -1713,6 +1731,7 @@ void CCNThread::beforeSleep() /* send a "no epg" event anyway before going to sleep */ sendCNEvent(); } + eit_retry = 0; } void CCNThread::processSection()