project-chip / rs-matter

Rust implementation of the Matter protocol. Status: Experimental
Apache License 2.0
323 stars 45 forks source link

Use the simpler readable() call which works for ESP IDF too #157

Closed ivmarkov closed 4 months ago

ivmarkov commented 4 months ago

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.