From f213daab829e68495c42009f73d540837df42fff Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 11 Mar 2020 12:07:58 +0100 Subject: Handle errors in EDI input --- src/input/Edi.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/input') diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index 7957bb5..6078b88 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -325,7 +325,13 @@ void Edi::m_run() fprintf(stderr, "Warning, possible UDP truncation\n"); } if (not packet.buffer.empty()) { - m_sti_decoder.push_packet(packet.buffer); + try { + m_sti_decoder.push_packet(packet.buffer); + } + catch (const runtime_error& e) { + etiLog.level(warn) << "EDI input " << m_name << " exception: " << e.what(); + this_thread::sleep_for(chrono::milliseconds(24)); + } } else { this_thread::sleep_for(chrono::milliseconds(12)); @@ -336,7 +342,13 @@ void Edi::m_run() { auto packet = m_tcp_receive_server.receive(); if (not packet.empty()) { - m_sti_decoder.push_bytes(packet); + try { + m_sti_decoder.push_bytes(packet); + } + catch (const runtime_error& e) { + etiLog.level(warn) << "EDI input " << m_name << " exception: " << e.what(); + this_thread::sleep_for(chrono::milliseconds(24)); + } } else { this_thread::sleep_for(chrono::milliseconds(12)); -- cgit v1.2.3