We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 105c172 commit 4414762Copy full SHA for 4414762
libraries/SocketWrapper/src/MbedClient.cpp
@@ -19,12 +19,12 @@ void arduino::MbedClient::readSocket() {
19
uint8_t data[SOCKET_BUFFER_SIZE];
20
int ret = NSAPI_ERROR_WOULD_BLOCK;
21
do {
22
- if (rxBuffer.availableForStore() == 0) {
+ mutex->lock();
23
+ if (sock != nullptr && rxBuffer.availableForStore() == 0) {
24
+ mutex->unlock();
25
yield();
26
continue;
- }
- mutex->lock();
27
- if (sock == nullptr) {
+ } else if (sock == nullptr) {
28
goto cleanup;
29
}
30
ret = sock->recv(data, rxBuffer.availableForStore());
0 commit comments