File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ def prepare_close(self) -> None:
292292
293293 # Resuming the writer to avoid deadlocks
294294 if self .paused :
295+ self .paused = False
295296 self .resume ()
296297
297298 def close (self ) -> None :
Original file line number Diff line number Diff line change @@ -806,6 +806,27 @@ async def test_close_preserves_queued_messages(self):
806806 self .assertEqual (str (exc ), "sent 1000 (OK); then received 1000 (OK)" )
807807 self .assertIsNone (exc .__cause__ )
808808
809+ async def test_close_preserves_queued_messages_gt_max_queue (self ):
810+ """
811+ close preserves messages buffered in the assembler, even if they
812+ exceed the default buffer size.
813+ """
814+
815+ for _ in range (100 ):
816+ await self .remote_connection .send ("😀" )
817+
818+ await self .connection .close ()
819+
820+ for _ in range (100 ):
821+ self .assertEqual (await self .connection .recv (), "😀" )
822+
823+ with self .assertRaises (ConnectionClosedOK ) as raised :
824+ await self .connection .recv ()
825+
826+ exc = raised .exception
827+ self .assertEqual (str (exc ), "sent 1000 (OK); then received 1000 (OK)" )
828+ self .assertIsNone (exc .__cause__ )
829+
809830 async def test_close_idempotency (self ):
810831 """close does nothing if the connection is already closed."""
811832 await self .connection .close ()
You can’t perform that action at this time.
0 commit comments