[ESP8266] Drop signalling SIGIO artificially if UDP send fails

With TCP it's desirable that SIGIO wakes up the application to check
if there is buffer space space available on the mode. With UDP the
behavior is not acceptable as we don't know if the other endpoint is
there as connection establishment is missing. Hence buffers might
stay full forever.
pull/9331/head
Veijo Pesonen 2019-01-10 12:18:26 +02:00
parent e25611aad8
commit 9a3c9a30b3
1 changed files with 3 additions and 1 deletions

View File

@ -505,9 +505,11 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
} while ((sendStartTime - rtos::Kernel::get_ms_count() < 50)
&& (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");
_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;