From: Peter van Dijk Date: Tue, 12 Mar 2013 14:33:48 +0000 (+0000) Subject: Replace select with waitForData in remotebackend. Patch by Aki Tuomi, closes #715 X-Git-Tag: rec-3.5-rc3~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c03cde1d0122ddfe2a8da18c7be008803252773;p=pdns Replace select with waitForData in remotebackend. Patch by Aki Tuomi, closes #715 git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3117 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/modules/remotebackend/httpconnector.cc b/modules/remotebackend/httpconnector.cc index 7edd2b8fe..af49cd4c6 100644 --- a/modules/remotebackend/httpconnector.cc +++ b/modules/remotebackend/httpconnector.cc @@ -1,7 +1,6 @@ #include "remotebackend.hh" #include #include -#include #include #include #include diff --git a/modules/remotebackend/unixconnector.cc b/modules/remotebackend/unixconnector.cc index c7894de30..c8c68ac2e 100644 --- a/modules/remotebackend/unixconnector.cc +++ b/modules/remotebackend/unixconnector.cc @@ -2,7 +2,6 @@ #include #include #include -#include #include #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 @@ -120,7 +119,6 @@ ssize_t UnixsocketConnector::write(const std::string &data) { void UnixsocketConnector::reconnect() { struct sockaddr_un sock; struct timeval tv; - fd_set rd; rapidjson::Document init,res; rapidjson::Value val; @@ -140,11 +138,7 @@ void UnixsocketConnector::reconnect() { fcntl(fd, F_SETFL, O_NONBLOCK, &fd); while(connect(fd, reinterpret_cast(&sock), sizeof sock)==-1 && (errno == EINPROGRESS)) { - tv.tv_sec = 0; - tv.tv_usec = 500; - FD_ZERO(&rd); - FD_SET(fd, &rd); - select(fd+1,&rd,NULL,NULL,&tv); // wait a moment + waitForData(fd, 0, 500); } if (errno != EISCONN && errno != 0) {