From 9ff6de6ecf0a7e255e62e3da5dbf1cb9f0981c99 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 23 Oct 2019 10:03:29 -0700 Subject: [PATCH] must stop c++ exception in C callbacks --- src/udp_collector.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/udp_collector.cpp b/src/udp_collector.cpp index 0511da9..179bcac 100644 --- a/src/udp_collector.cpp +++ b/src/udp_collector.cpp @@ -144,7 +144,11 @@ struct UDPCollector : public std::enable_shared_from_this static void handle_static(evutil_socket_t fd, short ev, void *raw) { (void)fd; - static_cast(raw)->handle(ev); + try { + static_cast(raw)->handle(ev); + }catch(std::exception& e) { + log_printf(logio, PLVL_CRIT, "Ignoring unhandled exception in UDPManager::handle(): %s\n", e.what()); + } } };