Skip to content

Commit 9a3c9a3

Browse files
author
Veijo Pesonen
committed
[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.
1 parent e25611a commit 9a3c9a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,11 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
505505
} while ((sendStartTime - rtos::Kernel::get_ms_count() < 50)
506506
&& (status != NSAPI_ERROR_OK));
507507

508-
if (status == NSAPI_ERROR_WOULD_BLOCK) {
508+
if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_TCP) {
509509
debug("Enqueuing the event call");
510510
_global_event_queue->call_in(100, callback(this, &ESP8266Interface::event));
511+
} else if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_UDP) {
512+
status = NSAPI_ERROR_DEVICE_ERROR;
511513
}
512514

513515
return status != NSAPI_ERROR_OK ? status : size;

0 commit comments

Comments
 (0)