mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
relay: attempt to fix race conditions in getRemoteUser calls (#92)
This commit is contained in:
parent
13e4baba8b
commit
65b8c9db8a
@ -16,7 +16,9 @@ dbname = "pylinkrelay"
|
||||
if confname != 'pylink':
|
||||
dbname += '-%s' % confname
|
||||
dbname += '.db'
|
||||
|
||||
relayusers = defaultdict(dict)
|
||||
spawnlocks = defaultdict(threading.Lock)
|
||||
|
||||
def relayWhoisHandlers(irc, target):
|
||||
user = irc.users[target]
|
||||
@ -124,6 +126,7 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True):
|
||||
return remoteirc.pseudoclient.uid
|
||||
except AttributeError: # Network hasn't been initialized yet?
|
||||
pass
|
||||
with spawnlocks[irc.name]:
|
||||
try:
|
||||
u = relayusers[(irc.name, user)][remoteirc.name]
|
||||
except KeyError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user