2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Cap the number of deferred packets

Prevent deferred packets from growing endlessly
if activity is keeping the loop running.
This commit is contained in:
Jarrod Johnson 2022-09-07 08:04:47 -04:00
parent 60cfa1d3c5
commit cde18bcd3a
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -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':