From a63118b37bd4256c7824599a66edfa513a0b969d Mon Sep 17 00:00:00 2001 From: Dorin Date: Mon, 15 Jan 2024 16:34:18 +0200 Subject: [PATCH] Fix double subtraction of bytes_read from num_to_read in recv_into --- adafruit_esp32spi/adafruit_esp32spi_socket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_esp32spi/adafruit_esp32spi_socket.py b/adafruit_esp32spi/adafruit_esp32spi_socket.py index 1cf379f..fa3a082 100644 --- a/adafruit_esp32spi/adafruit_esp32spi_socket.py +++ b/adafruit_esp32spi/adafruit_esp32spi_socket.py @@ -121,7 +121,7 @@ def recv_into(self, buffer, nbytes: int = 0): ) buffer[num_read : num_read + len(bytes_read)] = bytes_read num_read += len(bytes_read) - num_to_read -= num_read + num_to_read -= len(bytes_read) elif num_read > 0: # We got a message, but there are no more bytes to read, so we can stop. break