From cde18bcd3a6a42aae69ea3062d654c7ba51fb6f2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 7 Sep 2022 08:04:47 -0400 Subject: [PATCH] Cap the number of deferred packets Prevent deferred packets from growing endlessly if activity is keeping the loop running. --- confluent_server/confluent/discovery/protocols/slp.py | 2 +- confluent_server/confluent/discovery/protocols/ssdp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/discovery/protocols/slp.py b/confluent_server/confluent/discovery/protocols/slp.py index 0ab6ddc6..649c2707 100644 --- a/confluent_server/confluent/discovery/protocols/slp.py +++ b/confluent_server/confluent/discovery/protocols/slp.py @@ -482,7 +482,7 @@ def snoop(handler, protocol=None): known_peers = set([]) peerbymacaddress = {} deferpeers = [] - while r: + while r and len(deferpeers) < 256: for s in r: (rsp, peer) = s.recvfrom(9000) if peer in known_peers: diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index 937a5312..6600ca2d 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -173,7 +173,7 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None): if r: r = r[0] recent_peers = set([]) - while r: + while r and len(deferrednotifies) < 256: for s in r: (rsp, peer) = s.recvfrom(9000) if rsp[:4] == b'PING':