From 4715ba5ac01e8e6468bf28cc216a8df26d57b58d Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Fri, 10 Mar 2017 21:57:28 +0200 Subject: [PATCH] Increase poll time and add stop() command --- pupy/network/lib/picocmd/server.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pupy/network/lib/picocmd/server.py b/pupy/network/lib/picocmd/server.py index dfcf1f07..5f45fb37 100644 --- a/pupy/network/lib/picocmd/server.py +++ b/pupy/network/lib/picocmd/server.py @@ -481,10 +481,14 @@ class DnsCommandServer(object): self.tcp_server.resolver = handler self.tcp_server.logger = DNSLogger(log='log_error',prefix=False) - self.udp_server_thread = Thread(target=self.udp_server.serve_forever) + self.udp_server_thread = Thread( + target=self.udp_server.serve_forever, kwargs={ 'poll_interval': 5000 } + ) self.udp_server_thread.daemon = True - self.tcp_server_thread = Thread(target=self.tcp_server.serve_forever) + self.tcp_server_thread = Thread( + target=self.tcp_server.serve_forever, kwargs={ 'poll_interval': 5000 } + ) self.tcp_server_thread.daemon = True self.cleaner = Thread(target=handler.cleanup) @@ -494,3 +498,7 @@ class DnsCommandServer(object): self.cleaner.start() self.tcp_server_thread.start() self.udp_server_thread.start() + + def stop(self): + self.tcp_server.server_close() + self.udp_server.server_close()