(self)
Runs a DNSServer instance as a daemon thread (killed by program exit)
Runs a DNSServer instance as a daemon thread (killed by program exit)
Runs a DNSServer instance as a daemon thread ( killed by program exit )
def run(self):
        """
        Runs a DNSServer instance as a daemon thread (killed by program exit)
        """

        def _():
            try:
                self._running = True
                self._initialized = True

                while True:
                    data, addr = self._socket.recvfrom(1024)
                    _ = DNSQuery(data)
                    self._socket.sendto(_.response("127.0.0.1"), addr)

                    with self._lock:
                        self._requests.append(_._query)

            except KeyboardInterrupt:
                raise

            finally:
                self._running = False

        thread = threading.Thread(target=_)
        thread.daemon = True
        thread.start()
def run ( self ) : def _ ( ) : try : self . _running = True self . _initialized = True while True : data , addr = self . _socket . recvfrom ( 1024 ) _ = DNSQuery ( data ) self . _socket . sendto ( _ . response ( "127.0.0.1" ) , addr ) with self . _lock : self . _requests . append ( _ . _query ) except KeyboardInterrupt : raise finally : self . _running = False thread = threading . Thread ( target = _ ) thread . daemon = True thread . start ( )