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.
pull/9208/head
Russ Butler 2018-11-29 16:19:04 -06:00 committed by Cruz Monrreal II
parent 5be53a00d6
commit c8c68381d6
1 changed files with 3 additions and 4 deletions

View File

@ -782,10 +782,9 @@ int32_t ESP8266::recv_udp(int id, void *data, uint32_t amount, uint32_t timeout)
_smutex.lock(); _smutex.lock();
set_timeout(timeout); set_timeout(timeout);
// No flow control, drain the USART receive register ASAP to avoid data overrun // Process OOB data since this is
if (_serial_rts == NC) { // how UDP packets are received
_process_oob(timeout, true); _process_oob(timeout, true);
}
set_timeout(); set_timeout();