forked from p15670423/monkey
Agent: Lock RelayUserHandler.has_*_users()
This commit is contained in:
parent
90dcb0a91e
commit
e2736a9273
|
@ -76,18 +76,20 @@ class RelayUserHandler:
|
||||||
"""
|
"""
|
||||||
Return whether or not we have any potential users.
|
Return whether or not we have any potential users.
|
||||||
"""
|
"""
|
||||||
self._potential_users = dict(
|
with self._lock:
|
||||||
filter(lambda ru: not ru[1].timer.is_expired(), self._potential_users.items())
|
self._potential_users = dict(
|
||||||
)
|
filter(lambda ru: not ru[1].timer.is_expired(), self._potential_users.items())
|
||||||
|
)
|
||||||
|
|
||||||
return len(self._potential_users) > 0
|
return len(self._potential_users) > 0
|
||||||
|
|
||||||
def has_connected_users(self) -> bool:
|
def has_connected_users(self) -> bool:
|
||||||
"""
|
"""
|
||||||
Return whether or not we have any relay users.
|
Return whether or not we have any relay users.
|
||||||
"""
|
"""
|
||||||
self._relay_users = dict(
|
with self._lock:
|
||||||
filter(lambda ru: not ru[1].timer.is_expired(), self._relay_users.items())
|
self._relay_users = dict(
|
||||||
)
|
filter(lambda ru: not ru[1].timer.is_expired(), self._relay_users.items())
|
||||||
|
)
|
||||||
|
|
||||||
return len(self._relay_users) > 0
|
return len(self._relay_users) > 0
|
||||||
|
|
Loading…
Reference in New Issue