adafruit / Adafruit_CircuitPython_MiniMQTT

MQTT Client Library for CircuitPython
Other
73 stars 50 forks source link

Issue #126 #127

Closed jinglemansweep closed 1 year ago

jinglemansweep commented 1 year ago

Added bytearray('\x00') to the list of expected "noop" returns from the socket.

dhalbert commented 1 year ago

Use pre-commit or run the code through black to get rid of the failure: https://learn.adafruit.com/improve-your-code-with-pylint

brentru commented 1 year ago

@jinglemansweep Hi - thanks for fixing this issue. @dhalbert - I do not think this is a network or a MQTT spec issue, b"\x00 is rx'd after the call to res = self._sock_exact_recv(1).

Considering some in #126 are having issues with non-native wifi, it's possible (don't know, guessing right now) that the issue is within this library's local implementation of _sock_exact_recv() vs the native impl. of _sock_exact_recv() (cc @calcut ☝️ )

        # CPython socket module contains a timeout attribute
        if hasattr(self._socket_pool, "timeout"):
            try:
                res = self._sock_exact_recv(1)
            except self._socket_pool.timeout:
                return None
        else:  # socketpool, esp32spi
            try:
                res = self._sock_exact_recv(1)