From 0e475c8ddf6bd0f2fbff3e6d4e4516d6d23560b0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 11:44:10 +0100 Subject: [PATCH] sectionsd: try to improve cnthread update filter logic Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0bc1ad6abb030c8b5ceb84b3d48d2f2658e24286 Author: Stefan Seyfried Date: 2016-01-24 (Sun, 24 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 03100dc3f..6e8c6b4e5 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1719,10 +1719,21 @@ bool CCNThread::shouldSleep() 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); + /* on first retry, restart the demux. I'm not sure if it is a driver bug + * or a bug in our logic, but without this, I'm sometimes missing CN events + * and / or the eit_version and thus the update filter will stop working */ + if (++eit_retry < 2) { + xprintf("%s::%s first retry (%d) -> restart demux\n", name.c_str(), __func__, eit_retry); + change(0); /* this also resets lastChanged */ + } + /* ugly, this has been checked before. But timeoutsDMX can be < 0 for multiple reasons, + * and only skipTime should send CNThread finally to sleep if eit_version is not found */ + time_t since = time_monotonic() - lastChanged; + if (since > skipTime) { + xprintf("%s::%s timed out after %lds -> going to sleep\n", name.c_str(), __func__, since); return true; } + /* retry */ sendToSleepNow = false; return false; }