}
}
-void RecursorControlChannel::send(const std::string& msg, const std::string* remote)
+void RecursorControlChannel::send(const std::string& msg, const std::string* remote, unsigned int timeout)
{
+ int ret = waitForRWData(d_fd, false, timeout, 0);
+ if(ret == 0) {
+ throw PDNSException("Timeout sending message over control channel");
+ }
+ else if(ret < 0) {
+ throw PDNSException("Error sending message over control channel:" + string(strerror(errno)));
+ }
+
if(remote) {
struct sockaddr_un remoteaddr;
memset(&remoteaddr, 0, sizeof(remoteaddr));
uint64_t getStat(const std::string& name);
- void send(const std::string& msg, const std::string* remote=0);
+ void send(const std::string& msg, const std::string* remote=nullptr, unsigned int timeout=5);
std::string recv(std::string* remote=0, unsigned int timeout=5);
int d_fd;
command+=" ";
command+=commands[i];
}
- rccS.send(command);
+ rccS.send(command, nullptr, arg().asNum("timeout"));
string receive=rccS.recv(0, arg().asNum("timeout"));
if(receive.compare(0, 7, "Unknown") == 0) {
cerr<<receive<<endl;