Description
If I connect to a broker, subscribe to a topic, and no messages arrive from the broker within keep_alive
seconds, an exception is thrown and the object disconnects. Pings are not sent to the broker to keep the connection alive.
This happens because loop()
is actually blocking in the esp32spi implementation, and so doesn't get a chance to send/receive a ping to reset the object's timestamp.
loop()
is blocking because _wait_for_msg()
is blocking, which is because _sock_exact_recv()
is blocking as currently implemented, I think just in the ESP32SPI implementation without socketpool
. (Also note _sock_exact_recv()
is defined twice in the file, once around line 312 and again at 894.) It's a bit weird because the timeout sent to loop()
is applied to self._sock
but then _wait_for_msg
overwrites that (if it succeeds) with its own timeout. Either way the code in _sock_exact_recv
for ESP32SPI waits for keep_alive seconds and then throws an exception, which defeats loop
's ability to ping and reset the timestamp. I don't know what the "right behaviour" should be in this whole setup.
I am using a MatrixPortal with esp32spi.