Skip to content

Commit

Permalink
Merge pull request #9331 from VeijoPesonen/bugfix-esp8266_udp_prevent…
Browse files Browse the repository at this point in the history
…_would_block

ESP8266: prevent WOULD BLOCK from TX if UDP
  • Loading branch information
0xc0170 authored Jan 17, 2019
2 parents 694e45f + e9ceff2 commit b59b93e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/wifi/esp8266-driver/ESP8266Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,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) {
debug("Enqueuing the event call");
if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_TCP) {
tr_debug("ESP8266Interface::socket_send(): 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;
Expand Down

0 comments on commit b59b93e

Please sign in to comment.