Changeset 722
- Timestamp:
- 04/18/06 14:18:02 (7 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 2 modified
-
mplexer.hh (modified) (2 diffs)
-
pdns_recursor.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/mplexer.hh
r720 r722 78 78 } 79 79 80 virtual boost::any& getReadParameter(int fd) 81 { 82 if(!d_readCallbacks.count(fd)) 83 throw FDMultiplexerException("attempt to look up data in multiplexer for unlisted fd "+boost::lexical_cast<std::string>(fd)); 84 return d_readCallbacks[fd].d_parameter; 85 } 86 80 87 virtual std::vector<std::pair<int, boost::any> > getTimeouts(const struct timeval& tv) 81 88 { … … 97 104 98 105 virtual std::string getName() = 0; 106 99 107 100 108 protected: -
trunk/pdns/pdns/pdns_recursor.cc
r721 r722 526 526 g_fdm->removeReadFD(dc->d_socket); 527 527 close(dc->d_socket); 528 // i->closeAndCleanup(); // XXX we don't remove ourselves from the list anymore 529 } 530 else 531 ; // XXX FIXME, need to restore resetting connection to BYTE0 in case of noerror! 532 533 #if 0 534 for(vector<TCPConnection>::iterator i=g_tcpconnections.begin();i!=g_tcpconnections.end();++i) { 535 if(i->fd == dc->d_socket) { 536 if(hadError) { 537 i->closeAndCleanup(); 538 g_tcpconnections.erase(i); 539 } 540 else { 541 i->state=TCPConnection::BYTE0; 542 i->startTime=time(0); // needs to be current, TCP is slow anyhow 543 } 544 break; 545 } 546 } 547 #endif 528 } 529 else { 530 any_cast<TCPConnection&>(g_fdm->getReadParameter(dc->d_socket)).state=TCPConnection::BYTE0; 531 struct timeval now; 532 gettimeofday(&now, 0); // needs to be updated 533 g_fdm->setReadTTD(dc->d_socket, now, g_tcpTimeout); 534 } 548 535 } 549 536 … … 646 633 conn.bytesread+=bytes; 647 634 if(conn.bytesread==conn.qlen) { 648 // conn.state=TCPConnection::DONE; // this makes us immune from timeouts, from now on *we* are responsible 649 conn.state=TCPConnection::BYTE0; // *wrong* - yes, we want to listen for a new question already, but we shouldn't timeout etc 635 conn.state=TCPConnection::DONE; // this makes us immune from timeouts, from now on *we* are responsible 650 636 DNSComboWriter* dc=0; 651 637 try { … … 1314 1300 } 1315 1301 1316 if(!(counter%1 )) {1302 if(!(counter%11)) { 1317 1303 typedef vector<pair<int, boost::any> > expired_t; 1318 1304 expired_t expired=g_fdm->getTimeouts(g_now); … … 1320 1306 for(expired_t::iterator i=expired.begin() ; i != expired.end(); ++i) { 1321 1307 TCPConnection conn=any_cast<TCPConnection>(i->second); 1322 g_fdm->removeReadFD(i->first); 1323 cerr<<"Closed connection with our client "<<i->first<<"\n"; 1324 conn.closeAndCleanup(); 1308 if(conn.state != TCPConnection::DONE) { 1309 g_fdm->removeReadFD(i->first); 1310 conn.closeAndCleanup(); 1311 } 1325 1312 } 1326 1313 }