From: Bert Hubert Date: Thu, 29 Jul 2010 11:46:19 +0000 (+0000) Subject: remove duplicate & *wrong* waitForData() implementation from rec_channel - could... X-Git-Tag: rec-3.3~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10ecdfc23ec6941df567c8b3abab81dbb4f45625;p=pdns remove duplicate & *wrong* waitForData() implementation from rec_channel - could've caused crashes under high load git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1675 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/Makefile-recursor b/pdns/Makefile-recursor index dc8fa8f5b..aec2833d9 100644 --- a/pdns/Makefile-recursor +++ b/pdns/Makefile-recursor @@ -21,7 +21,8 @@ rec_channel.o rec_channel_rec.o selectmplexer.o sillyrecords.o \ dns_random.o aescrypt.o aeskey.o aes_modes.o aestab.o lua-pdns-recursor.o \ randomhelper.o recpacketcache.o dns.o reczones.o base32.o nsecrecords.o -REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o +REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o misc.o \ + unix_utility.o logger.o qtype.o # what we need all: message pdns_recursor rec_control diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index 34d09d88e..78e1c9bf5 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -1,6 +1,7 @@ #include "rec_channel.hh" #include #include +#include "misc.hh" #include #include #include @@ -121,27 +122,6 @@ void RecursorControlChannel::send(const std::string& msg, const std::string* rem throw AhuException("Unable to send message over control channel: "+string(strerror(errno))); } -// returns -1 in case if error, 0 if no data is available, 1 if there is. In the first two cases, errno is set -static int waitForData(int fd, int seconds, int useconds) -{ - struct timeval tv; - int ret; - - tv.tv_sec = seconds; - tv.tv_usec = useconds; - - fd_set readfds; - FD_ZERO( &readfds ); - FD_SET( fd, &readfds ); - - ret = select( fd + 1, &readfds, NULL, NULL, (seconds + useconds) ? &tv : 0 ); - if ( ret == 0 ) - errno = ETIMEDOUT; - - return ret; -} - - string RecursorControlChannel::recv(std::string* remote, unsigned int timeout) { char buffer[16384];