Changeset 723
- Timestamp:
- 04/18/06 14:49:46 (7 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/pdns_recursor.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r722 r723 255 255 void returnSocket(socks_t::iterator& i) 256 256 { 257 if(i==d_socks.end()) { 258 throw AhuException("Trying to return a socket not in the pool"); 259 } 257 260 g_fdm->removeReadFD(i->first); 258 261 ::close(i->first); … … 1044 1047 void handleUDPServerResponse(int fd, boost::any& var) 1045 1048 { 1046 PacketID & pid=any_cast<PacketID&>(var);1049 PacketID pid=any_cast<PacketID>(var); 1047 1050 int len; 1048 1051 char data[1500]; … … 1051 1054 1052 1055 len=recvfrom(fd, data, sizeof(data), 0, (sockaddr *)&fromaddr, &addrlen); 1053 g_udpclientsocks.returnSocket(fd); 1056 1054 1057 1055 1058 if(len < (int)sizeof(dnsheader)) { … … 1063 1066 } 1064 1067 string empty; 1068 g_udpclientsocks.returnSocket(fd); 1065 1069 MT->sendEvent(pid, &empty); // this denotes error 1066 1070 return; … … 1097 1101 L<<Logger::Warning<<"Ignoring question on outgoing socket from "<< sockAddrToString((struct sockaddr_in*) &fromaddr, addrlen) <<endl; 1098 1102 } 1099 1100 #if 01101 // this code sweeps all running tcp connections for timeouts, it didn't survive move to multiplexer1102 vector<TCPConnection> sweeped;1103 1104 for(vector<TCPConnection>::iterator i=g_tcpconnections.begin();i!=g_tcpconnections.end();++i) {1105 if(i->state==TCPConnection::DONE || g_now.tv_sec < i->startTime + tcpTimeout) { // don't timeout when we are working on the question!1106 sweeped.push_back(*i);1107 if(i->state!=TCPConnection::DONE) { // we don't listen for data when we are processing the question1108 FD_SET(i->fd, &readfds);1109 fdmax=max(fdmax,i->fd);1110 }1111 }1112 else {1113 if(g_logCommonErrors)1114 L<<Logger::Error<<"TCP timeout from client "<<inet_ntoa(i->remote.sin_addr)<<endl;1115 i->closeAndCleanup();1116 }1117 }1118 sweeped.swap(g_tcpconnections);1119 #endif1120 1103 1121 1104 FDMultiplexer* getMultiplexer() … … 1307 1290 TCPConnection conn=any_cast<TCPConnection>(i->second); 1308 1291 if(conn.state != TCPConnection::DONE) { 1292 if(g_logCommonErrors) 1293 L<<Logger::Warning<<"Timeout from remote TCP client "<<sockAddrToString(&conn.remote,sizeof(conn.remote))<<endl; 1309 1294 g_fdm->removeReadFD(i->first); 1310 1295 conn.closeAndCleanup(); … … 1321 1306 gettimeofday(&g_now, 0); 1322 1307 g_fdm->run(&g_now); 1323 1324 1308 1325 1309 if(listenOnTCP) {