daemon: updates to remove the delay for processing wlan changes along with code to support it
This commit is contained in:
parent
43737a42e4
commit
efb97d1a5d
2 changed files with 24 additions and 51 deletions
|
@ -343,14 +343,12 @@ class BasicRangeModel(WirelessModel):
|
|||
:return: nothing
|
||||
"""
|
||||
x, y, z = iface.node.position.get()
|
||||
self.iface_lock.acquire()
|
||||
self.iface_to_pos[iface] = (x, y, z)
|
||||
if x is None or y is None:
|
||||
self.iface_lock.release()
|
||||
return
|
||||
for iface2 in self.iface_to_pos:
|
||||
self.calclink(iface, iface2)
|
||||
self.iface_lock.release()
|
||||
with self.iface_lock:
|
||||
self.iface_to_pos[iface] = (x, y, z)
|
||||
if x is None or y is None:
|
||||
return
|
||||
for iface2 in self.iface_to_pos:
|
||||
self.calclink(iface, iface2)
|
||||
|
||||
position_callback = set_position
|
||||
|
||||
|
@ -388,20 +386,15 @@ class BasicRangeModel(WirelessModel):
|
|||
"""
|
||||
if iface == iface2:
|
||||
return
|
||||
|
||||
try:
|
||||
x, y, z = self.iface_to_pos[iface]
|
||||
x2, y2, z2 = self.iface_to_pos[iface2]
|
||||
|
||||
if x2 is None or y2 is None:
|
||||
return
|
||||
|
||||
d = self.calcdistance((x, y, z), (x2, y2, z2))
|
||||
|
||||
# ordering is important, to keep the wlan._linked dict organized
|
||||
a = min(iface, iface2)
|
||||
b = max(iface, iface2)
|
||||
|
||||
with self.wlan.linked_lock:
|
||||
linked = self.wlan.is_linked(a, b)
|
||||
if d > self.range:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue