Skip to content

Commit b59b93e

Browse files
authored
Merge pull request #9331 from VeijoPesonen/bugfix-esp8266_udp_prevent_would_block
ESP8266: prevent WOULD BLOCK from TX if UDP
2 parents 694e45f + e9ceff2 commit b59b93e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 4 additions & 2 deletions
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) {
512-
debug("Enqueuing the event call");
511+
if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_TCP) {
512+
tr_debug("ESP8266Interface::socket_send(): 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)