diff --git a/zeroconf.py b/zeroconf.py index b2277168c..57a1cc608 100644 --- a/zeroconf.py +++ b/zeroconf.py @@ -1078,8 +1078,6 @@ def __init__(self, zc, type_, handlers=None, listener=None): self.done = False - self.zc.add_listener(self, DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN)) - if hasattr(handlers, 'add_service'): listener = handlers handlers = None @@ -1147,6 +1145,8 @@ def cancel(self): self.join() def run(self): + self.zc.add_listener(self, DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN)) + while True: now = current_time_millis() if len(self._handlers_to_call) == 0 and self.next_time > now: