receiver: lock on actual handle, not just on handle number

This commit is contained in:
Peter F. Patel-Schneider 2021-09-24 15:43:54 -04:00
parent 0d9fe48b0c
commit 585a3b901a
1 changed files with 4 additions and 4 deletions

View File

@ -360,11 +360,11 @@ handles_lock = {}
def handle_lock(handle): def handle_lock(handle):
with request_lock: with request_lock:
if handles_lock.get(int(handle)) is None: if handles_lock.get(handle) is None:
if _log.isEnabledFor(_INFO): if _log.isEnabledFor(_INFO):
_log.info('New lock %s', int(handle)) _log.info('New lock %s', repr(handle))
handles_lock[int(handle)] = _threading.Lock() # Serialize requests on the handle handles_lock[handle] = _threading.Lock() # Serialize requests on the handle
return handles_lock[int(handle)] return handles_lock[handle]
# context manager for locks with a timeout # context manager for locks with a timeout