Skip to content

Commit

Permalink
fixes if add() is successful but send() is not, write() will return n…
Browse files Browse the repository at this point in the history
…o bytes written however the bytes still get added in the queue to be sent me-no-dev#144  me-no-dev#144
  • Loading branch information
diodenschein committed Aug 17, 2022
1 parent ca8ac5f commit 3e300fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,12 @@ size_t AsyncClient::write(const char* data) {

size_t AsyncClient::write(const char* data, size_t size, uint8_t apiflags) {
size_t will_send = add(data, size, apiflags);
if(!will_send || !send()) {
if (!will_send) {
return 0;
}
while (connected() && !send()) {
taskYIELD();
}
return will_send;
}

Expand Down

0 comments on commit 3e300fd

Please sign in to comment.