Changeset 1402 for trunk/pdns/pdns/pdns_recursor.cc
- Timestamp:
- 09/22/09 12:14:43 (10 months ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/pdns_recursor.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r1354 r1402 67 67 FDMultiplexer* g_fdm; 68 68 unsigned int g_maxTCPPerClient; 69 unsigned int g_networkTimeoutMsec; 69 70 bool g_logCommonErrors; 70 71 shared_ptr<PowerDNSLua> g_pdl; … … 85 86 g_tcpListenSockets_t g_tcpListenSockets; 86 87 int g_tcpTimeout; 88 87 89 map<int, ComboAddress> g_listenSocketsAddresses; 88 90 struct DNSComboWriter { … … 152 154 string packet; 153 155 154 int ret=MT->waitEvent(pident, &packet, 1);156 int ret=MT->waitEvent(pident, &packet, g_networkTimeoutMsec); 155 157 156 158 if(!ret || ret==-1) { // timeout … … 174 176 g_fdm->addReadFD(sock->getHandle(), handleTCPClientReadable, pident); 175 177 176 int ret=MT->waitEvent(pident, &data,1);178 int ret=MT->waitEvent(pident, &data, g_networkTimeoutMsec); 177 179 if(!ret || ret==-1) { // timeout 178 180 g_fdm->removeReadFD(sock->getHandle()); … … 340 342 g_fdm->addReadFD(*fd, handleUDPServerResponse, pident); 341 343 ret=send(*fd, data, len, 0); 344 int tmp = errno; 342 345 if(ret < 0) 343 346 g_udpclientsocks.returnSocket(*fd); 347 errno = tmp; // this is for logging purposes only 344 348 return ret; 345 349 } … … 347 351 // -1 is error, 0 is timeout, 1 is success 348 352 int arecvfrom(char *data, int len, int flags, const ComboAddress& fromaddr, int *d_len, 349 uint16_t id, const string& domain, uint16_t qtype, int fd, unsigned intnow)353 uint16_t id, const string& domain, uint16_t qtype, int fd, struct timeval* now) 350 354 { 351 355 static optional<unsigned int> nearMissLimit; … … 361 365 362 366 string packet; 363 int ret=MT->waitEvent(pident, &packet, 1, now);367 int ret=MT->waitEvent(pident, &packet, g_networkTimeoutMsec, now); 364 368 365 369 if(ret > 0) { … … 1811 1815 } 1812 1816 1817 g_networkTimeoutMsec = ::arg().asNum("network-timeout"); 1813 1818 parseAuthAndForwards(); 1814 1819 … … 1895 1900 1896 1901 for(;;) { 1897 while(MT->schedule( g_now.tv_sec)); // housekeeping, let threads do their thing1902 while(MT->schedule(&g_now)); // housekeeping, let threads do their thing 1898 1903 1899 1904 if(!(counter%500)) { … … 1993 1998 ::arg().set("setgid","If set, change group id to this gid for more security")=""; 1994 1999 ::arg().set("setuid","If set, change user id to this uid for more security")=""; 2000 ::arg().set("network-timeout", "Wait this nummer of milliseconds for network i/o")="1500"; 1995 2001 #ifdef WIN32 1996 2002 ::arg().set("quiet","Suppress logging of questions and answers")="off";