@@ -495,7 +495,7 @@ def data_received(self, data: bytes) -> None:
495
495
return
496
496
497
497
self ._bytes_ready += len (data )
498
- self ._buffers .append (memoryview [ data ] )
498
+ self ._buffers .append (memoryview ( data ) )
499
499
500
500
if not len (self ._pending_reads ):
501
501
return
@@ -505,9 +505,6 @@ def data_received(self, data: bytes) -> None:
505
505
waiter = self ._pending_listeners .popleft ()
506
506
waiter .set_result (data )
507
507
508
- def eof_received (self ):
509
- self .close (OSError ("connection closed" ))
510
-
511
508
async def read (self , bytes_needed : int ) -> bytes :
512
509
"""Read up to the requested bytes from this connection."""
513
510
# Note: all reads are "up-to" bytes_needed because we don't know if the kms_context
@@ -552,8 +549,9 @@ def _read(self, bytes_needed: int) -> memoryview:
552
549
# if we didn't exhaust the buffer, read the partial data and return the buffer.
553
550
if buf_size > n_remaining :
554
551
output_buf [out_index : n_remaining + out_index ] = buffer [:n_remaining ]
552
+ buffer = buffer [n_remaining :]
555
553
n_remaining = 0
556
- self ._buffers .appendleft (buffer [ n_remaining :] )
554
+ self ._buffers .appendleft (buffer )
557
555
# otherwise exhaust the buffer.
558
556
else :
559
557
output_buf [out_index : out_index + buf_size ] = buffer [:]
0 commit comments