Skip to content

Commit

Permalink
Merge pull request #896 from JAndrassy/mbedclient_read_stopped_crash_fix
Browse files Browse the repository at this point in the history
SocketWrapper MbedClient read() fixes
  • Loading branch information
facchinm authored Jun 19, 2024
2 parents 3e7b881 + fab0676 commit 14950ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/SocketWrapper/src/MbedClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ int arduino::MbedClient::available() {
}

int arduino::MbedClient::read() {
if (sock == nullptr)
return -1;
mutex->lock();
if (!available()) {
mutex->unlock();
Expand All @@ -241,6 +243,8 @@ int arduino::MbedClient::read() {
}

int arduino::MbedClient::read(uint8_t *data, size_t len) {
if (sock == nullptr)
return 0;
mutex->lock();
int avail = available();

Expand Down

0 comments on commit 14950ea

Please sign in to comment.