From 5e8b7b7c5e66a2a85066f74b531d01af40c6c38c Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 31 Mar 2014 22:07:15 +0300 Subject: [PATCH] Fixed keepalive heartbeat again. --- HISTORY | 3 ++- po/de_DE.po | 4 ++-- po/fi_FI.po | 4 ++-- tuner.c | 15 +++++---------- tuner.h | 5 ++--- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/HISTORY b/HISTORY index 0bb60df..7c34a51 100644 --- a/HISTORY +++ b/HISTORY @@ -26,9 +26,10 @@ VDR Plugin 'satip' Revision History - Fixed pid leaking while disabling section filters. - Fixed keepalive heartbeat. -2014-03-30: Version 0.2.1 +2014-04-01: Version 0.2.1 - Changed implementation to report about RTP packet errors on 5 minutes interval only. - Added a check to write new sections only if there is no data in the read socket. +- Fixed keepalive heartbeat again. diff --git a/po/de_DE.po b/po/de_DE.po index 5561797..3f9adff 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: vdr-satip 0.2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-30 03:30+0200\n" -"PO-Revision-Date: 2014-03-30 03:30+0200\n" +"POT-Creation-Date: 2014-04-01 04:01+0200\n" +"PO-Revision-Date: 2014-04-01 04:01+0200\n" "Last-Translator: Frank Neumann \n" "Language-Team: German \n" "Language: de\n" diff --git a/po/fi_FI.po b/po/fi_FI.po index 0e170c2..4826776 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: vdr-satip 0.2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-30 03:30+0200\n" -"PO-Revision-Date: 2014-03-30 03:30+0200\n" +"POT-Creation-Date: 2014-04-01 04:01+0200\n" +"PO-Revision-Date: 2014-04-01 04:01+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish \n" "Language: fi\n" diff --git a/tuner.c b/tuner.c index 1915db2..c6ff97b 100644 --- a/tuner.c +++ b/tuner.c @@ -27,7 +27,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) keepAliveM(), pidUpdateCacheM(), sessionM(), - timeoutM(eDefKeepAliveIntervalMs), + timeoutM(eMinKeepAliveIntervalMs), openedM(false), tunedM(false), hasLockM(false), @@ -83,9 +83,9 @@ size_t cSatipTuner::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void int timeout = -1; char *session = NULL; if (sscanf(r, "Session:%m[^;];timeout=%11d", &session, &timeout) == 2) - obj->SetSessionTimeout(skipspace(session), timeout); + obj->SetSessionTimeout(skipspace(session), (timeout - 1) * 1000); else if (sscanf(r, "Session:%m[^;]", &session) == 1) - obj->SetSessionTimeout(skipspace(session), -1); + obj->SetSessionTimeout(skipspace(session)); FREE_POINTER(session); } r = strtok_r(NULL, "\r\n", &s); @@ -304,7 +304,7 @@ bool cSatipTuner::Disconnect(void) if (currentServerM) cSatipDiscover::GetInstance()->UseServer(currentServerM, false); tunedM = false; - timeoutM = eDefKeepAliveIntervalMs; + timeoutM = eMinKeepAliveIntervalMs; return true; } @@ -383,12 +383,7 @@ void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP) cMutexLock MutexLock(&mutexM); debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, sessionP, timeoutP); sessionM = sessionP; - if (timeoutP > 30) - timeoutM = timeoutP * 1000L; - else if (timeoutP > 0) - timeoutM = eMinKeepAliveIntervalMs; - else - timeoutM = eDefKeepAliveIntervalMs; + timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs; } bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP) diff --git a/tuner.h b/tuner.h index 12f8153..0f07351 100644 --- a/tuner.h +++ b/tuner.h @@ -29,8 +29,7 @@ private: eConnectTimeoutMs = 1500, // in milliseconds ePidUpdateIntervalMs = 100, // in milliseconds eReConnectTimeoutMs = 5000, // in milliseconds - eMinKeepAliveIntervalMs = 300000, // in milliseconds - eDefKeepAliveIntervalMs = 600000 // in milliseconds + eMinKeepAliveIntervalMs = 300000 // in milliseconds }; static size_t HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP); @@ -67,7 +66,7 @@ private: bool ValidateLatestResponse(void); void ParseReceptionParameters(const char *paramP); void SetStreamId(int streamIdP); - void SetSessionTimeout(const char *sessionP, int timeoutP); + void SetSessionTimeout(const char *sessionP, int timeoutP = 0); bool KeepAlive(void); bool UpdateSignalInfoCache(void); bool UpdatePids(void);