Skip to content

Commit adacbb1

Browse files
authored
Fix limit of reads based on nbytes
1 parent 2cf98c0 commit adacbb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_esp32spi/adafruit_esp32spi_socket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ def recv_into(self, buffer, nbytes=None):
172172

173173
stamp = time.monotonic()
174174
to_read = len(buffer)
175-
nbytes = to_read if nbytes is None else to_read - nbytes
175+
limit = to_read if nbytes is None else to_read - nbytes
176176
received = []
177-
while to_read > len(buffer) - nbytes:
177+
while to_read > limit:
178178
# print("Bytes to read:", to_read)
179179
avail = self.available()
180180
if avail:

0 commit comments

Comments
 (0)