Permalink
Browse files

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
  • Loading branch information...
1 parent 450292c commit 2c03cde1d0122ddfe2a8da18c7be008803252773 @Habbie Habbie committed Mar 12, 2013
Showing with 1 addition and 8 deletions.
  1. +0 −1 modules/remotebackend/httpconnector.cc
  2. +1 −7 modules/remotebackend/unixconnector.cc
@@ -1,7 +1,6 @@
#include "remotebackend.hh"
#include <sys/socket.h>
#include <unistd.h>
-#include <sys/select.h>
#include <fcntl.h>
#include <boost/foreach.hpp>
#include <sstream>
@@ -2,7 +2,6 @@
#include <sys/socket.h>
#include <pdns/lock.hh>
#include <unistd.h>
-#include <sys/select.h>
#include <fcntl.h>
#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<struct sockaddr*>(&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) {

0 comments on commit 2c03cde

Please sign in to comment.