コード例 #1
0
    def _register_new_socket(self):  #, client_query=None):
        with self._DNSServer.server_lock:
            for tls_server in self._DNSServer.dns_servers:

                # skipping over known down server
                if (not tls_server[self._protocol]): continue

                # attempting to connect via tls. if successful will return True, otherwise mark server as
                # down and try next server.
                if self._tls_connect(tls_server['ip']): return True

                self.mark_server_down()

            else:
                self._DNSServer.tls_up = False

                # NOTE: i dont think this gets hit anymore??? investigate after two server fails,
                # the client would have already asked again. this would probably not help anything
                # even if it technically did get hit sometimes. after tls is marked down they will
                # be pushed over to fallback by queue.
                # sending to fallback relay(udp) if enabled and client_query is present
                # if (self._DNSServer.udp_fallback and client_query):
                #     self._send_to_fallback(client_query)

                Log.error('NO SECURE SERVERS AVAILABLE!')
コード例 #2
0
    def _register_new_socket(self, client_query=None):
        with self.DNSServer.server_lock:
            for tls_server in self.DNSServer.dns_servers:
                if (not tls_server[self._protocol]): continue

                if self._tls_connect(tls_server['ip']): return True

                self.mark_server_down()
            else:
                Log.error('NO SECURE SERVERS AVAILABLE!')
                self.DNSServer.tls_up = False
                if (self.DNSServer.udp_fallback and client_query):
                    self._send_to_fallback(client_query)