From 01d8415a694bf7a3532e8dc7a6c355cb0ff032cc Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 17 Jan 2024 09:03:32 +0100 Subject: Remove useless catch, because recv() doesn't throw it --- src/EtiReader.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp index eda2f23..5726713 100644 --- a/src/EtiReader.cpp +++ b/src/EtiReader.cpp @@ -561,7 +561,7 @@ void EdiTransport::Open(const std::string& uri) m_mcastaddr = host_full.substr(found_mcast+1); } else if (found_port != 6) { - m_bindto=host_full; + m_bindto = host_full; } etiLog.level(info) << "EDI UDP input: host:" << m_bindto << @@ -648,23 +648,19 @@ bool EdiTransport::rxPacket() // discontinuity. m_tcpbuffer.resize(512); const int timeout_ms = 1000; - try { - ssize_t ret = m_tcpclient.recv(m_tcpbuffer.data(), m_tcpbuffer.size(), 0, timeout_ms); - if (ret <= 0) { - return false; - } - else if (ret > (ssize_t)m_tcpbuffer.size()) { - throw logic_error("EDI TCP: invalid recv() return value"); - } - else { - m_tcpbuffer.resize(ret); - m_decoder.push_bytes(m_tcpbuffer); - return true; - } - } - catch (const Socket::TCPSocket::Timeout&) { + + ssize_t ret = m_tcpclient.recv(m_tcpbuffer.data(), m_tcpbuffer.size(), 0, timeout_ms); + if (ret <= 0) { return false; } + else if (ret > (ssize_t)m_tcpbuffer.size()) { + throw logic_error("EDI TCP: invalid recv() return value"); + } + else { + m_tcpbuffer.resize(ret); + m_decoder.push_bytes(m_tcpbuffer); + return true; + } } } throw logic_error("Incomplete rxPacket implementation!"); -- cgit v1.2.3