]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Detach snmp thread to avoid trouble when trying to quit nicely. 9492/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 21 Sep 2020 13:22:08 +0000 (15:22 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 21 Sep 2020 13:26:27 +0000 (15:26 +0200)
This avoids a case where the thread object and the RecursorSNMPAgent
object get destroyed in the wrong order.

pdns/snmp-agent.hh

index c304aad47c3c4b1dfd673e4c0bc16ae5fa71863d..db8d44559f91e3b69dfe6ef98bdcddf97c0817eb 100644 (file)
@@ -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 */
   }