Skip to content

Commit 53ed3f5

Browse files
committed
Fix ESP8266 recv_udp timeout with flow control
UDP packets are always received as OOB data. Without checking for new OOB data with a call to "_process_oob" then recv_udp never blocks. If a UDP packet is not available then NSAPI_ERROR_WOULD_BLOCK is returned. This causes mbed-os's DNS handling to always fail when flow control is enabled. This patch fixes recv_udp by always calling "_process_oob" regardless of if flow control is enabled. This ensures that recv_udp follows the timeout parameter and waits for new data to arrive.
1 parent e2ae84e commit 53ed3f5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

components/wifi/esp8266-driver/ESP8266/ESP8266.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,9 @@ int32_t ESP8266::recv_udp(int id, void *data, uint32_t amount, uint32_t timeout)
755755
_smutex.lock();
756756
set_timeout(timeout);
757757

758-
// No flow control, drain the USART receive register ASAP to avoid data overrun
759-
if (_serial_rts == NC) {
760-
_process_oob(timeout, true);
761-
}
758+
// Process OOB data since this is
759+
// how UDP packets are received
760+
_process_oob(timeout, true);
762761

763762
set_timeout();
764763

0 commit comments

Comments
 (0)