Changeset 1640

Show
Ignore:
Timestamp:
06/18/10 20:57:02 (3 years ago)
Author:
ahu
Message:

perform better accounting of TCP client numbers on DNS errors - spotted by Simon Bedford and Laurent Papier.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/pdns_recursor.cc

    r1637 r1640  
    595595        // no need to remove us from FDM, we weren't there 
    596596        TCPConnection::closeAndCleanup(dc->d_socket, dc->d_remote); 
     597        dc->d_socket = -1; 
    597598      } 
    598599      else { 
     
    632633 
    633634    delete dc; 
     635    dc=0; 
    634636  } 
    635637  catch(AhuException &ae) { 
    636638    L<<Logger::Error<<"startDoResolve problem: "<<ae.reason<<endl; 
     639    if(dc && dc->d_tcp && dc->d_socket >= 0)  
     640      TCPConnection::closeAndCleanup(dc->d_socket, dc->d_remote); 
     641    delete dc; 
    637642  } 
    638643  catch(MOADNSException& e) { 
     644    if(dc && dc->d_tcp && dc->d_socket >= 0)  
     645      TCPConnection::closeAndCleanup(dc->d_socket, dc->d_remote); 
     646       
    639647    L<<Logger::Error<<"DNS parser error: "<<dc->d_mdp.d_qname<<", "<<e.what()<<endl; 
     648    delete dc; 
    640649  } 
    641650  catch(std::exception& e) { 
    642651    L<<Logger::Error<<"STL error: "<<e.what()<<endl; 
     652    if(dc && dc->d_tcp && dc->d_socket >= 0)  
     653      TCPConnection::closeAndCleanup(dc->d_socket, dc->d_remote); 
     654    delete dc; 
    643655  } 
    644656  catch(...) { 
     
    15241536    vector<string> ips; 
    15251537    stringtok(ips, ::arg()["allow-from"], ", "); 
     1538     
    15261539    L<<Logger::Warning<<"Only allowing queries from: "; 
    15271540    for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) { 
     
    15931606    ips.push_back("0.0.0.0"); 
    15941607    ips.push_back("::"); 
     1608 
    15951609    L<<Logger::Warning<<"Will not send queries to: "; 
    15961610    for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) {