Skip to content

Commit

Permalink
ClientContext:_write_some: release buffer once data really accepted f…
Browse files Browse the repository at this point in the history
…or sending (#4265)

may fix #1872
  • Loading branch information
d-a-v authored Feb 1, 2018
1 parent 9ba8f77 commit 199fe0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/ESP8266WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,13 @@ class ClientContext
}
err_t err = tcp_write(_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY);
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, (int) err);
_datasource->release_buffer(buf, next_chunk);
if (err == ERR_OK) {
_datasource->release_buffer(buf, next_chunk);
_written += next_chunk;
need_output = true;
} else {
// ERR_MEM(-1) is a valid error meaning
// "come back later". It leaves state() opened
break;
}
will_send -= next_chunk;
Expand Down

0 comments on commit 199fe0f

Please sign in to comment.