2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-08-22 03:00:29 +00:00

Reduce calls to update_neigh

On a mostly stable system, update_neigh will
continue to drive a significant portion of
background activity. Mitigate to only call if
circumstances suggest a need, or once every
30 seconds.
This commit is contained in:
Jarrod Johnson
2020-11-09 09:00:57 -05:00
parent edaaa2393d
commit 8f99d87fda
2 changed files with 8 additions and 6 deletions

View File

@@ -468,15 +468,16 @@ def snoop(handler, protocol=None):
# will now yield dupe info over time
known_peers = set([])
peerbymacaddress = {}
neighutil.update_neigh()
while r:
for s in r:
(rsp, peer) = s.recvfrom(9000)
ip = peer[0].partition('%')[0]
if ip not in neighutil.neightable:
continue
if peer in known_peers:
continue
if ip not in neighutil.neightable:
neighutil.update_neigh()
if ip not in neighutil.neightable:
continue
known_peers.add(peer)
mac = neighutil.neightable[ip]
if mac in peerbymacaddress:

View File

@@ -118,7 +118,6 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
newmacs = set([])
machandlers = {}
r, _, _ = select.select((net4, net6), (), (), 60)
neighutil.update_neigh()
while r:
for s in r:
(rsp, peer) = s.recvfrom(9000)
@@ -128,10 +127,12 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
method, _, _ = rsp[0].split(b' ', 2)
if method == b'NOTIFY':
ip = peer[0].partition('%')[0]
if ip not in neighutil.neightable:
continue
if peer in known_peers:
continue
if ip not in neighutil.neightable:
neighutil.update_neigh()
if ip not in neighutil.neightable:
continue
mac = neighutil.neightable[ip]
known_peers.add(peer)
newmacs.add(mac)