adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT
Is `_backwards_compatible_sock` flag still needed
- Dominant language
- Python
- Stars
- 81
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
Is `_backwards_compatible_sock` flag still needed? In `MQTT._sock_exact_recv` there is [this code](https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/47422868d2ea782c865198d98dc502e4fd721f63/adafruit_minimqtt/adafruit_minimqtt.py#L1171C1-L1208C22):
```
if not self._backwards_compatible_sock:
# CPython/Socketpool Impl.
...
else: # ESP32SPI Impl.
# This will timeout with socket timeout (not keepalive timeout)
...
```
This flag is set by:
```
self._backwards_compatible_sock = not hasattr(sock, "recv_into")
```
[here](https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/47422868d2ea782c865198d98dc502e4fd721f63/adafruit_minimqtt/adafruit_minimqtt.py#L369)
Yet at this point both the [ESP32SPI library](https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/0adb75b898a133d929eb14baa2e54b7e9e23899c/adafruit_esp32spi/adafruit_esp32spi_socket.py#L101) and [WIZNET5k library](https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/blob/3bd953e288e6837c749b22ab436e2311465cecbc/adafruit_wiznet5k/adafruit_wiznet5k_socket.py#L548) have `recv_into`.
The [FONA library](https://github.com/adafruit/Adafruit_CircuitPython_FONA/blob/main/adafruit_fona/adafruit_fona_socket.py) is the only one I see that doesn't
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in adafruit_minimqtt/adafruit_minimqtt.py at the assignment of _backwards_compatible_sock and MQTT._sock_exact_recv. Compare the recv_into support and receive behavior in the linked ESP32SPI, WIZNET5k, and FONA socket implementations. Done means establishing whether the compatibility branch is still required and updating the affected logic and tests accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100