Changeset 1366
- Timestamp:
- 06/24/09 23:11:30 (9 months ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 4 modified
-
docs/rec_control.1.txt (modified) (1 diff)
-
rec_channel.cc (modified) (3 diffs)
-
rec_channel.hh (modified) (1 diff)
-
rec_control.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/docs/rec_control.1.txt
r823 r1366 42 42 --socket-pid:: 43 43 When running in SMP mode, pid of pdns_recursor to control 44 45 --timeout:: 46 Number of seconds to wait for the remote PowerDNS Recursor to 47 respond. Set to 0 for infinite. 44 48 45 49 COMMANDS -
trunk/pdns/pdns/rec_channel.cc
r1170 r1366 134 134 FD_SET( fd, &readfds ); 135 135 136 ret = select( fd + 1, &readfds, NULL, NULL, &tv);136 ret = select( fd + 1, &readfds, NULL, NULL, (seconds + useconds) ? &tv : 0 ); 137 137 if ( ret == 0 ) 138 138 errno = ETIMEDOUT; … … 142 142 143 143 144 string RecursorControlChannel::recv(std::string* remote )144 string RecursorControlChannel::recv(std::string* remote, unsigned int timeout) 145 145 { 146 146 char buffer[16384]; … … 149 149 socklen_t addrlen=sizeof(remoteaddr); 150 150 151 if((waitForData(d_fd, 5, 0 ) != 1) || (len=::recvfrom(d_fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&remoteaddr, &addrlen)) < 0)151 if((waitForData(d_fd, timeout, 0 ) != 1) || (len=::recvfrom(d_fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&remoteaddr, &addrlen)) < 0) 152 152 throw AhuException("Unable to receive message over control channel: "+string(strerror(errno))); 153 153 -
trunk/pdns/pdns/rec_channel.hh
r1170 r1366 30 30 31 31 void send(const std::string& msg, const std::string* remote=0); 32 std::string recv(std::string* remote=0 );32 std::string recv(std::string* remote=0, unsigned int timeout=5); 33 33 34 34 int d_fd; -
trunk/pdns/pdns/rec_control.cc
r1028 r1366 36 36 arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR; 37 37 arg().set("socket-pid","When controlling multiple recursors, the target pid")=""; 38 38 arg().set("timeout", "Number of seconds to wait for the recursor to respond")="5"; 39 39 arg().setCmd("help","Provide this helpful message"); 40 40 … … 68 68 } 69 69 rccS.send(command); 70 string receive=rccS.recv( );70 string receive=rccS.recv(0, arg().asNum("timeout")); 71 71 cout<<receive; 72 72 return 0;