Skip to content

Commit 64bb010

Browse files
Veijo Pesonenadbridge
authored andcommitted
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 97bf0d5 commit 64bb010

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
@@ -508,9 +508,11 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
508508
} while ((sendStartTime - rtos::Kernel::get_ms_count() < 50)
509509
&& (status != NSAPI_ERROR_OK));
510510

511-
if (status == NSAPI_ERROR_WOULD_BLOCK) {
511+
if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_TCP) {
512512
debug("Enqueuing the event call");
513513
_global_event_queue->call_in(100, callback(this, &ESP8266Interface::event));
514+
} else if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_UDP) {
515+
status = NSAPI_ERROR_DEVICE_ERROR;
514516
}
515517

516518
return status != NSAPI_ERROR_OK ? status : size;

0 commit comments

Comments
 (0)