]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: improve tcp exception handling 11123/head
authorKees Monshouwer <mind04@monshouwer.org>
Wed, 22 Dec 2021 12:18:57 +0000 (13:18 +0100)
committermind04 <mind04@monshouwer.org>
Wed, 22 Dec 2021 13:33:02 +0000 (14:33 +0100)
pdns/tcpreceiver.cc

index b9c619eb2d7751012ca35132afe93c4673c95924..2b0127f8a1920a1e86097963519b028fdc2ec9f2 100644 (file)
@@ -359,11 +359,15 @@ void TCPNameserver::doConnection(int fd)
   }
 
   catch(std::exception &e) {
-    g_log<<Logger::Error<<"TCP Connection Thread died because of STL error: "<<e.what()<<endl;
+    std::lock_guard<std::mutex> l(s_plock);
+    s_P.reset(); // on next call, backend will be recycled
+    g_log << Logger::Error << "TCP Connection Thread died because of STL error, cycling backend: " << e.what() << endl;
   }
   catch( ... )
   {
-    g_log << Logger::Error << "TCP Connection Thread caught unknown exception." << endl;
+    std::lock_guard<std::mutex> l(s_plock);
+    s_P.reset(); // on next call, backend will be recycled
+    g_log << Logger::Error << "TCP Connection Thread caught unknown exception, cycling backend." << endl;
   }
   d_connectionroom_sem->post();