]> granicus.if.org Git - pdns/commitdiff
improve timeout reporting in rec_control
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 8 Jan 2015 15:59:33 +0000 (16:59 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 8 Jan 2015 15:59:33 +0000 (16:59 +0100)
pdns/rec_channel.cc

index 1b28b1edcd1d18e9e6c0e825ab42e998014b44d9..e08484e8a3ce7f2837acb92327ab3b8c6feaf4ed 100644 (file)
@@ -121,8 +121,12 @@ string RecursorControlChannel::recv(std::string* remote, unsigned int timeout)
   ssize_t len;
   struct sockaddr_un remoteaddr;
   socklen_t addrlen=sizeof(remoteaddr);
-    
-  if((waitForData(d_fd, timeout, 0 ) != 1) || (len=::recvfrom(d_fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&remoteaddr, &addrlen)) < 0)
+  
+  int ret=waitForData(d_fd, timeout, 0);
+  if(ret==0)
+    throw PDNSException("Timeout waiting for answer from control channel");
+  
+  if( ret < 0 || (len=::recvfrom(d_fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&remoteaddr, &addrlen)) < 0)
     throw PDNSException("Unable to receive message over control channel: "+string(strerror(errno)));
 
   if(remote)