From: bert hubert Date: Thu, 8 Jan 2015 15:59:33 +0000 (+0100) Subject: improve timeout reporting in rec_control X-Git-Tag: rec-3.7.0-rc1~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12997e9d800734da51b808767e1e2477244c30eb;p=pdns improve timeout reporting in rec_control --- diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index 1b28b1edc..e08484e8a 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -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)