From d5f0744f4bf093afc5ff2e962f4da27e97013fc0 Mon Sep 17 00:00:00 2001 From: schmirl Date: Fri, 4 Sep 2009 13:24:34 +0000 Subject: [PATCH] use SO_KEEPALIVE option on all sockets do detect dead sockets --- CONTRIBUTORS | 3 +++ HISTORY | 2 ++ tools/socket.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2d4ef6b..fb7293e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -100,6 +100,9 @@ Jori Hamalainen for extensive testing while making stream compatible to Network Media Tank for adding Network Media Tank browser support to HTML pages +owagner + for suggesting use of SO_KEEPALIVE socket option to detect dead sockets + Joachim König-Baltes for fixing Min/MaxPriority parsing diff --git a/HISTORY b/HISTORY index 3f4929d..eae2865 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,8 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- use SO_KEEPALIVE option on all sockets do detect dead sockets (thanks to + owagner) - enable PatFilter for externremux, so VLC can be used as remuxer or client - fixed insecure format strings in LSTX handlers (thanks to Anssi Hannula) - updated Finish translation (thanks to Rolf Ahrenberg) diff --git a/tools/socket.c b/tools/socket.c index 3523c29..5dde45a 100644 --- a/tools/socket.c +++ b/tools/socket.c @@ -124,6 +124,10 @@ bool cTBSocket::Accept(const cTBSocket &Listener) { if (::getsockname(socket, (struct sockaddr*)&m_LocalAddr, &addrlen) == -1) return false; + int sol=1; + // Ignore possible errors here, proceed as usual + ::setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, &sol, sizeof(sol)); + if (!cTBSource::Open(socket)) return false;