Skip to content

Commit 69e8819

Browse files
author
Jarrod Johnson
committed
Remove retransmits
in mDNS, when things are working well, announcements come in asynchronously. Therefore we can refrain from spamming the network with multicast searches every 20 seconds.
1 parent 064b12f commit 69e8819

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

zeroconf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,13 @@ def cancel(self):
13171317
def run(self):
13181318
self.zc.add_listener(self, DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN))
13191319

1320+
out = DNSOutgoing(_FLAGS_QR_QUERY)
1321+
out.add_question(DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN))
1322+
for record in self.services.values():
1323+
if not record.is_expired(now):
1324+
out.add_answer_at_time(record, now)
1325+
1326+
self.zc.send(out)
13201327
while True:
13211328
now = current_time_millis()
13221329
if len(self._handlers_to_call) == 0 and self.next_time > now:
@@ -1325,13 +1332,6 @@ def run(self):
13251332
return
13261333
now = current_time_millis()
13271334
if self.next_time <= now:
1328-
out = DNSOutgoing(_FLAGS_QR_QUERY)
1329-
out.add_question(DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN))
1330-
for record in self.services.values():
1331-
if not record.is_expired(now):
1332-
out.add_answer_at_time(record, now)
1333-
1334-
self.zc.send(out)
13351335
self.next_time = now + self.delay
13361336
self.delay = min(20 * 1000, self.delay * 2)
13371337

0 commit comments

Comments
 (0)