1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

ClientContext:_write_some: release buffer once data really accepted for sending (#4265)

may fix #1872
This commit is contained in:
david gauchard 2018-02-01 11:49:04 +01:00 committed by GitHub
parent 9ba8f77678
commit 199fe0f16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -447,11 +447,13 @@ protected:
} }
err_t err = tcp_write(_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY); 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); DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, (int) err);
_datasource->release_buffer(buf, next_chunk);
if (err == ERR_OK) { if (err == ERR_OK) {
_datasource->release_buffer(buf, next_chunk);
_written += next_chunk; _written += next_chunk;
need_output = true; need_output = true;
} else { } else {
// ERR_MEM(-1) is a valid error meaning
// "come back later". It leaves state() opened
break; break;
} }
will_send -= next_chunk; will_send -= next_chunk;