@@ -128,6 +128,12 @@ def __init__(self, host, port=None, secure=None, window_manager=None, enable_pus
128128 # be synchronized, it uses _send_cb internally (which is serialized);
129129 # it's other activity (safe deletion of the stream from self.streams)
130130 # does not require synchronization.
131+ #
132+ # _read_lock may be acquired when already holding the _write_lock,
133+ # when they both held it is always by acquiring _write_lock first
134+ #
135+ # either _read_lock or _write_lock may be acquired whilst holding _lock
136+ # which should always be acquired before either of the other two.
131137 self ._lock = threading .RLock ()
132138 self ._write_lock = threading .RLock ()
133139 self ._read_lock = threading .RLock ()
@@ -836,8 +842,7 @@ def _recv_cb(self, stream_id=0):
836842 """
837843 # Concurrency
838844 #
839- # Synchronizes reading data, using the same rentrant lock as when data
840- # is written. i.e, reads and writes to the connection are serialized.
845+ # Synchronizes reading data
841846 #
842847 # i/o occurs while the lock is held; waiting threads will see a delay.
843848 with self ._read_lock :
@@ -855,11 +860,10 @@ def _recv_cb(self, stream_id=0):
855860 # If the connection has been closed, bail out.
856861 try :
857862 self ._consume_single_frame ()
858- count -= 1
859863 except ConnectionResetError :
860864 break
861865
862- count -= 1
866+ count -= 1
863867
864868 def _send_rst_frame (self , stream_id , error_code ):
865869 """
0 commit comments