From 89d41261d989eb35379773e619fba3cf5e3ee718 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 4 May 2016 08:06:12 +0100 Subject: [PATCH] Handle a failing socket. --- DMRIPSC.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DMRIPSC.cpp b/DMRIPSC.cpp index b82aad6..966a272 100644 --- a/DMRIPSC.cpp +++ b/DMRIPSC.cpp @@ -295,6 +295,12 @@ void CDMRIPSC::clock(unsigned int ms) in_addr address; unsigned int port; int length = m_socket.read(m_buffer, BUFFER_LENGTH, address, port); + if (length < 0) { + LogError("Socket has failed, retrying connection"); + close(); + open(); + return; + } // if (m_debug && length > 0) // CUtils::dump(1U, "IPSC Received", m_buffer, length);