mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9331 from VeijoPesonen/bugfix-esp8266_udp_prevent_would_block
ESP8266: prevent WOULD BLOCK from TX if UDPpull/9415/head
commit
b59b93e828
|
@ -508,9 +508,11 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
|
||||||
} while ((sendStartTime - rtos::Kernel::get_ms_count() < 50)
|
} while ((sendStartTime - rtos::Kernel::get_ms_count() < 50)
|
||||||
&& (status != NSAPI_ERROR_OK));
|
&& (status != NSAPI_ERROR_OK));
|
||||||
|
|
||||||
if (status == NSAPI_ERROR_WOULD_BLOCK) {
|
if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_TCP) {
|
||||||
debug("Enqueuing the event call");
|
tr_debug("ESP8266Interface::socket_send(): enqueuing the event call");
|
||||||
_global_event_queue->call_in(100, callback(this, &ESP8266Interface::event));
|
_global_event_queue->call_in(100, callback(this, &ESP8266Interface::event));
|
||||||
|
} else if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_UDP) {
|
||||||
|
status = NSAPI_ERROR_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status != NSAPI_ERROR_OK ? status : size;
|
return status != NSAPI_ERROR_OK ? status : size;
|
||||||
|
|
Loading…
Reference in New Issue