Skip to content

Commit

Permalink
Moved recvlock release to after the dispatch and added comments about…
Browse files Browse the repository at this point in the history
… release
  • Loading branch information
comrumino committed Jul 2, 2022
1 parent 94dbe36 commit 299ca14
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rpyc/core/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,17 @@ def serve(self, timeout=1, wait_for_lock=True): # serving
with self._recv_event:
self._recv_event.notify_all()
raise
else:
# At this point, the recvlock was acquired once, we must release once before exiting the function
if data:
# Dispatch will unbox, invoke callbacks, etc.
self._dispatch(data)
self._recvlock.release()
with self._recv_event:
self._recv_event.notify_all()
if not data:
return False
else:
self._dispatch(data)
return True
else:
self._recvlock.release()
return False

def poll(self, timeout=0): # serving
"""Serves a single transaction, should one arrives in the given
Expand Down

0 comments on commit 299ca14

Please sign in to comment.