]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Make sure that the TCP distribution pipes are non-blocking
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 21 Mar 2019 17:36:33 +0000 (18:36 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 4 Apr 2019 09:54:04 +0000 (11:54 +0200)
pdns/dnsdist-tcp.cc
pdns/dnsdist.hh

index 35f7c19a86c736b69a53ea6f13cb530cd9e03ab2..9889583e98bb184c035e5d1a74b4adcc5b395efb 100644 (file)
@@ -209,6 +209,13 @@ void TCPClientCollection::addTCPClientThread()
       return;
     }
 
+    if (!setNonBlocking(pipefds[0])) {
+      close(pipefds[0]);
+      close(pipefds[1]);
+      errlog("Error setting the TCP thread communication pipe non-blocking: %s", strerror(errno));
+      return;
+    }
+
     if (!setNonBlocking(pipefds[1])) {
       close(pipefds[0]);
       close(pipefds[1]);
index eed5d469401d4883bb82ed2c987d40e51636efc4..f76888c09c39e985d0d5220010895c5cf7db4b38 100644 (file)
@@ -636,6 +636,14 @@ public:
       if (pipe(d_singlePipe) < 0) {
         throw std::runtime_error("Error creating the TCP single communication pipe: " + string(strerror(errno)));
       }
+
+      if (!setNonBlocking(d_singlePipe[0])) {
+        int err = errno;
+        close(d_singlePipe[0]);
+        close(d_singlePipe[1]);
+        throw std::runtime_error("Error setting the TCP single communication pipe non-blocking: " + string(strerror(err)));
+      }
+
       if (!setNonBlocking(d_singlePipe[1])) {
         int err = errno;
         close(d_singlePipe[0]);