Changeset 1414 for trunk/pdns/pdns/pdns_recursor.cc
- Timestamp:
- 09/26/09 19:50:04 (4 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/pdns_recursor.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r1413 r1414 49 49 #include <boost/function.hpp> 50 50 #include <boost/algorithm/string.hpp> 51 #include <netinet/tcp.h> 51 52 #include "dnsparser.hh" 52 53 #include "dnswriter.hh" … … 84 85 NetmaskGroup* g_dontQuery; 85 86 string s_programname="pdns_recursor"; 86 typedef vector<int> g_tcpListenSockets_t;87 g_tcpListenSockets_t g_tcpListenSockets; // is shared per thread!! 87 typedef vector<int> tcpListenSockets_t; 88 tcpListenSockets_t g_tcpListenSockets; // shared across threads, but this is fine, never written to from a thread. All threads listen on all sockets 88 89 int g_tcpTimeout; 89 90 //MemcachedCommunicator* g_mc; 90 91 // DHCPCommunicator* g_dc; 91 map<int, ComboAddress> g_listenSocketsAddresses; // is shared per thread!92 map<int, ComboAddress> g_listenSocketsAddresses; // is shared across all threads right now 92 93 struct DNSComboWriter { 93 94 DNSComboWriter(const char* data, uint16_t len, const struct timeval& now) : d_mdp(data, len), d_now(now), d_tcp(false), d_socket(-1) … … 1107 1108 1108 1109 deferredAdd.push_back(make_pair(fd, handleNewUDPQuestion)); 1109 // g_listenSocketsAddresses[fd]=sin; // XXX FIXME ERASED BECAUSE OF MULTITHREADING1110 g_listenSocketsAddresses[fd]=sin; // this is written to only from the startup thread, not from the workers 1110 1111 if(sin.sin4.sin_family == AF_INET) 1111 1112 L<<Logger::Error<<"Listening for UDP queries on "<< sin.toString() <<":"<<st.port<<endl; … … 2028 2029 2029 2030 if(listenOnTCP) { 2030 if(TCPConnection::s_currentConnections > maxTcpClients) { // shutdown 2031 for( g_tcpListenSockets_t::iterator i=g_tcpListenSockets.begin(); i != g_tcpListenSockets.end(); ++i)2031 if(TCPConnection::s_currentConnections > maxTcpClients) { // shutdown, too many connections 2032 for(tcpListenSockets_t::iterator i=g_tcpListenSockets.begin(); i != g_tcpListenSockets.end(); ++i) 2032 2033 t_fdm->removeReadFD(*i); 2033 2034 listenOnTCP=false; … … 2036 2037 else { 2037 2038 if(TCPConnection::s_currentConnections <= maxTcpClients) { // reenable 2038 for( g_tcpListenSockets_t::iterator i=g_tcpListenSockets.begin(); i != g_tcpListenSockets.end(); ++i)2039 for(tcpListenSockets_t::iterator i=g_tcpListenSockets.begin(); i != g_tcpListenSockets.end(); ++i) 2039 2040 t_fdm->addReadFD(*i, handleNewTCPQuestion); 2040 2041 listenOnTCP=true;