def __init__(self, timeout=3): self.timeout = timeout self.waiters = lru_cache.LruCache(100) self.dns_server = self.get_local_dns_server() self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.sock6 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) self.sock.settimeout(1) self.sock6.settimeout(1) self.running = True self.th = threading.Thread(target=self.recv_worker, args=(self.sock,)) self.th.start() self.th6 = threading.Thread(target=self.recv_worker, args=(self.sock6,)) self.th6.start()
def __init__(self, timeout=3): self.timeout = timeout self.waiters = lru_cache.LruCache(100) self.dns_server = self.get_local_dns_server() self.start()