From: Otto Moerbeek Date: Mon, 21 Sep 2020 13:22:08 +0000 (+0200) Subject: Detach snmp thread to avoid trouble when trying to quit nicely. X-Git-Tag: auth-4.4.0-alpha1~25^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9492%2Fhead;p=thirdparty%2Fpdns.git 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. --- 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 */ }