From 7828c5a3af47f9eed7026bbf112e5fda9734c4fa Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 21 Sep 2020 15:22:08 +0200 Subject: [PATCH] Detach snmp thread to avoid trouble when trying to quit nicely. This avoids a case where the thread object and the RecursorSNMPAgent object get destroyed in the wrong order. --- pdns/snmp-agent.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pdns/snmp-agent.hh b/pdns/snmp-agent.hh index c304aad47c..db8d44559f 100644 --- a/pdns/snmp-agent.hh +++ b/pdns/snmp-agent.hh @@ -24,6 +24,7 @@ public: virtual ~SNMPAgent() { #ifdef HAVE_NET_SNMP + close(d_trapPipe[0]); close(d_trapPipe[1]); #endif /* HAVE_NET_SNMP */ @@ -33,6 +34,7 @@ public: { #ifdef HAVE_NET_SNMP d_thread = std::thread(&SNMPAgent::worker, this); + d_thread.detach(); #endif /* HAVE_NET_SNMP */ } -- 2.47.2