We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
arduino
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
2 parents ba5f661 + b172e12 commit 1749b20Copy full SHA for 1749b20
libraries/SocketWrapper/src/MbedClient.cpp
@@ -22,15 +22,13 @@ void arduino::MbedClient::readSocket() {
22
int ret = NSAPI_ERROR_WOULD_BLOCK;
23
do {
24
mutex->lock();
25
- if (sock == nullptr) {
26
- goto cleanup;
27
- }
28
- mutex->unlock();
29
- if (rxBuffer.availableForStore() == 0) {
+ if (sock != nullptr && rxBuffer.availableForStore() == 0) {
+ mutex->unlock();
30
yield();
31
continue;
+ } else if (sock == nullptr) {
+ goto cleanup;
32
}
33
- mutex->lock();
34
ret = sock->recv(data, rxBuffer.availableForStore());
35
if (ret < 0 && ret != NSAPI_ERROR_WOULD_BLOCK) {
36
goto cleanup;
0 commit comments