The existing peek-based implementation is essentially a workaround for something which - as it turns out - async-io supports with a simpler method: readable.
More important: turns out that peek is unreliable on the ESP IDF (lwIP) + async-io. Not sure yet why, but sometimes this method blocks and does not indicate readability even when there is a UDP packet in the IP layer RX queue.
With this simple fix, the complex ESP IDF BLE+Wifi "light" provisioning example works reliably, provisioning the device every single time, without any noticeable delays or timeouts.
The existing
peek
-based implementation is essentially a workaround for something which - as it turns out -async-io
supports with a simpler method:readable
.More important: turns out that
peek
is unreliable on the ESP IDF (lwIP) +async-io
. Not sure yet why, but sometimes this method blocks and does not indicate readability even when there is a UDP packet in the IP layer RX queue.With this simple fix, the complex ESP IDF BLE+Wifi "light" provisioning example works reliably, provisioning the device every single time, without any noticeable delays or timeouts.