From f6b482abc3e4f3670dfd8463d021d92b1ef33103 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 13 May 2008 19:39:19 +0000 Subject: [PATCH] Timeouts, keepalives... --- command.cc | 1 + eventdispatcher.cc | 3 ++- playerlivetv.cc | 2 +- vdr.cc | 10 ++++++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/command.cc b/command.cc index a2b1968..910db61 100644 --- a/command.cc +++ b/command.cc @@ -525,6 +525,7 @@ void Command::doFromTheTop(bool which) { if (which) { + logger->log("Command", Log::NOTICE, "Doing connection lost dialog"); connLost = new VInfo(); connLost->setSize(360, 200); connLost->createBuffer(); diff --git a/eventdispatcher.cc b/eventdispatcher.cc index b03f23d..9a73235 100644 --- a/eventdispatcher.cc +++ b/eventdispatcher.cc @@ -111,7 +111,8 @@ void EventDispatcher::edUnregister(EDReceiver* edr) if (*i == edr) break; // found } - if (i == receivers.end()) abort(); // should never happen + if (i == receivers.end()) return; // Not in the list. Already unregistered? Perhaps vdr::connectionDied already removed this streamclient + // FIXME, this should probably be done another way. A call to edUnregister with an object that may or may not be in the list? Not good. if (!edr->callinprogress) { diff --git a/playerlivetv.cc b/playerlivetv.cc index 6295ee9..85230eb 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -505,7 +505,7 @@ bool PlayerLiveTV::checkError() { if (!vdr->isConnected()) { - switchState(S_STOP); + if (state != S_STOP) switchState(S_STOP); Message* m = new Message(); m->from = this; diff --git a/vdr.cc b/vdr.cc index 31f0d47..0e1ba97 100644 --- a/vdr.cc +++ b/vdr.cc @@ -234,7 +234,7 @@ void VDR::threadMethod() if (!tcp->isConnected()) { connectionDied(); return; } // return to stop this thread - timeoutCount = 0; // disable it for now + timeoutCount = 0; // disable it for now if (timeoutCount >= 10) //20s { @@ -244,6 +244,7 @@ void VDR::threadMethod() if (lastKAsent == 0) { + logger->log("VDR", Log::DEBUG, "Sending KA packet"); if (!sendKA(timeNow)) { connectionDied(); return; } lastKAsent = timeNow; continue; @@ -325,6 +326,7 @@ void VDR::threadMethod() { lastKAsent = 0; timeoutCount = 0; + logger->log("VDR", Log::ERR, "Rxd correct KA reply"); } } else @@ -386,7 +388,10 @@ void VDR::connectionDied() logger->log("VDR", Log::ERR, "Timeouts: no waiting stream receiver found for streamid %lu !!!", vdrpr->streamID); delete vresp; } - edLock(); + edLock(); + + for(EDRL::iterator i = receivers.begin(); i != receivers.end(); i++) + if ((VDR_PacketReceiver*)*i == vdrpr) { receivers.erase(i); break; } } } edUnlock(); @@ -426,6 +431,7 @@ VDR_ResponsePacket* VDR::RequestResponse(VDR_RequestPacket* vrp) if (!connected) { + logger->log("VDR", Log::DEBUG, "RR when !connected"); VDR_ResponsePacket* vresp = new VDR_ResponsePacket(); return vresp; // "no-response" return } -- 2.39.2