Skip to content

Commit 2542b26

Browse files
committed
Implement correct usage of limit based on nbytes argument
1 parent 43cb366 commit 2542b26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_esp32spi/adafruit_esp32spi_socket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ def recv_into(self, buffer, nbytes=0):
177177

178178
stamp = time.monotonic()
179179
to_read = len(buffer)
180+
limit = 0 if nbytes == 0 else to_read - nbytes
180181
received = []
181-
while to_read > nbytes:
182+
while to_read > limit:
182183
# print("Bytes to read:", to_read)
183184
avail = self.available()
184185
if avail:

0 commit comments

Comments
 (0)