@@ -419,6 +419,7 @@ def settimeout(self, timeout: float | None) -> None:
419
419
self .conn [1 ].settimeout (timeout )
420
420
421
421
async def close (self ) -> None :
422
+ # print(f"Closing network interface from {''.join(traceback.format_stack())}")
422
423
self .conn [0 ].abort ()
423
424
await self .conn [1 ].wait_closed ()
424
425
@@ -528,8 +529,10 @@ async def read(self, request_id: Optional[int], max_message_size: int) -> tuple[
528
529
self ._start_index = 0
529
530
self ._op_code = None # type: ignore[assignment]
530
531
self ._overflow = None
532
+ self ._is_compressed = False
533
+ self ._compressor_id = None
531
534
if self .transport and self .transport .is_closing ():
532
- raise OSError ("Connection is closed" )
535
+ raise OSError ("connection is already closed" )
533
536
read_waiter = asyncio .get_running_loop ().create_future ()
534
537
self ._pending_messages .append (read_waiter )
535
538
try :
@@ -581,6 +584,9 @@ def get_buffer(self, sizehint: int) -> memoryview:
581
584
If any data does not fit into the returned buffer, this method will be called again until
582
585
either no data remains or an empty buffer is returned.
583
586
"""
587
+ # TODO: This is super hacky and is purely for debugging purposes
588
+ if sizehint == 0 :
589
+ return memoryview (bytearray (256 ))
584
590
if self ._overflow is not None :
585
591
return self ._overflow [self ._overflow_index :]
586
592
return self ._buffer [self ._end_index :]
0 commit comments