Skip to content

Commit 6369439

Browse files
committed
ClientContext:_write_some: release buffer once data really accepted for sending
may fix #1872
1 parent 9ba8f77 commit 6369439

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/ESP8266WiFi/src/include/ClientContext.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,13 @@ class ClientContext
447447
}
448448
err_t err = tcp_write(_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY);
449449
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, (int) err);
450-
_datasource->release_buffer(buf, next_chunk);
451450
if (err == ERR_OK) {
451+
_datasource->release_buffer(buf, next_chunk);
452452
_written += next_chunk;
453453
need_output = true;
454454
} else {
455+
// ERR_MEM(-1) is a valid error meaning
456+
// "come back later". It leaves state() opened
455457
break;
456458
}
457459
will_send -= next_chunk;

0 commit comments

Comments
 (0)