File tree 4 files changed +26
-6
lines changed
4 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,18 @@ notice.
35
35
Bug fixes
36
36
.........
37
37
38
- * Fixed ``connection.recv(timeout=0) `` in the :mod: `threading ` implementation.
39
- If a message is already received, it is returned. Previously,
40
- :exc: `TimeoutError ` was raised incorrectly.
41
-
42
38
* Wrapped errors when reading the opening handshake request or response in
43
39
:exc: `~exceptions.InvalidMessage ` so that :func: `~asyncio.client.connect `
44
40
raises :exc: `~exceptions.InvalidHandshake ` or a subclass when the opening
45
41
handshake fails.
46
42
43
+ * Fixed :meth: `~sync.connection.Connection.recv ` with ``timeout=0 `` in the
44
+ :mod: `threading ` implementation. If a message is already received, it is
45
+ returned. Previously, :exc: `TimeoutError ` was raised incorrectly.
46
+
47
+ * Prevented :meth: `~sync.connection.Connection.close ` from blocking when
48
+ receive buffers are saturated in the :mod: `threading ` implementation.
49
+
47
50
.. _14.1 :
48
51
49
52
14.1
Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ def close(self) -> None:
283
283
"""
284
284
End the stream of frames.
285
285
286
- Callling :meth:`close` concurrently with :meth:`get`, :meth:`get_iter`,
286
+ Calling :meth:`close` concurrently with :meth:`get`, :meth:`get_iter`,
287
287
or :meth:`put` is safe. They will raise :exc:`EOFError`.
288
288
289
289
"""
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ def close(self) -> None:
298
298
"""
299
299
End the stream of frames.
300
300
301
- Callling :meth:`close` concurrently with :meth:`get`, :meth:`get_iter`,
301
+ Calling :meth:`close` concurrently with :meth:`get`, :meth:`get_iter`,
302
302
or :meth:`put` is safe. They will raise :exc:`EOFError`.
303
303
304
304
"""
@@ -311,3 +311,8 @@ def close(self) -> None:
311
311
if self .get_in_progress :
312
312
# Unblock get() or get_iter().
313
313
self .frames .put (None )
314
+
315
+ if self .paused :
316
+ # Unblock recv_events().
317
+ self .paused = False
318
+ self .resume ()
Original file line number Diff line number Diff line change @@ -496,6 +496,18 @@ def test_put_fails_after_close(self):
496
496
with self .assertRaises (EOFError ):
497
497
self .assembler .put (Frame (OP_TEXT , b"caf\xc3 \xa9 " ))
498
498
499
+ def test_close_resumes_reading (self ):
500
+ """close unblocks reading when queue is above the high-water mark."""
501
+ self .assembler .put (Frame (OP_TEXT , b"caf\xc3 \xa9 " ))
502
+ self .assembler .put (Frame (OP_TEXT , b"more caf\xc3 \xa9 " ))
503
+ self .assembler .put (Frame (OP_TEXT , b"water" ))
504
+
505
+ # queue is at the high-water mark
506
+ assert self .assembler .paused
507
+
508
+ self .assembler .close ()
509
+ self .resume .assert_called_once_with ()
510
+
499
511
def test_close_is_idempotent (self ):
500
512
"""close can be called multiple times safely."""
501
513
self .assembler .close ()
You can’t perform that action at this time.
0 commit comments