mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
parent
775eb9b343
commit
5a5af55d3a
@ -483,20 +483,24 @@ protected:
|
|||||||
if (!next_chunk_size)
|
if (!next_chunk_size)
|
||||||
break;
|
break;
|
||||||
const uint8_t* buf = _datasource->get_buffer(next_chunk_size);
|
const uint8_t* buf = _datasource->get_buffer(next_chunk_size);
|
||||||
// use TCP_WRITE_FLAG_MORE to remove PUSH flag from packet (lwIP's doc),
|
|
||||||
// because PUSH code implicitely disables Nagle code (see lwIP's tcp_out.c)
|
uint8_t flags = 0;
|
||||||
// Notes:
|
if (next_chunk_size < _datasource->available())
|
||||||
// PUSH is meant for peer, telling to give data to user app as soon as received
|
// PUSH is meant for peer, telling to give data to user app as soon as received
|
||||||
// PUSH "may be set" when sender has finished sending a meaningful data block
|
// PUSH "may be set" when sender has finished sending a "meaningful" data block
|
||||||
// PUSH is quite unclear in its application
|
// PUSH does not break Nagle
|
||||||
// Nagle is for shortly delaying outgoing data, to send less/bigger packets
|
// #5173: windows needs this flag
|
||||||
uint8_t flags = TCP_WRITE_FLAG_MORE; // do not tcp-PuSH
|
// more info: https://lists.gnu.org/archive/html/lwip-users/2009-11/msg00018.html
|
||||||
|
flags |= TCP_WRITE_FLAG_MORE; // do not tcp-PuSH (yet)
|
||||||
if (!_sync)
|
if (!_sync)
|
||||||
// user data must be copied when data are sent but not yet acknowledged
|
// user data must be copied when data are sent but not yet acknowledged
|
||||||
// (with sync, we wait for acknowledgment before returning to user)
|
// (with sync, we wait for acknowledgment before returning to user)
|
||||||
flags |= TCP_WRITE_FLAG_COPY;
|
flags |= TCP_WRITE_FLAG_COPY;
|
||||||
|
|
||||||
err_t err = tcp_write(_pcb, buf, next_chunk_size, flags);
|
err_t err = tcp_write(_pcb, buf, next_chunk_size, flags);
|
||||||
|
|
||||||
DEBUGV(":wrc %d %d %d\r\n", next_chunk_size, _datasource->available(), (int)err);
|
DEBUGV(":wrc %d %d %d\r\n", next_chunk_size, _datasource->available(), (int)err);
|
||||||
|
|
||||||
if (err == ERR_OK) {
|
if (err == ERR_OK) {
|
||||||
_datasource->release_buffer(buf, next_chunk_size);
|
_datasource->release_buffer(buf, next_chunk_size);
|
||||||
_written += next_chunk_size;
|
_written += next_chunk_size;
|
||||||
@ -512,7 +516,7 @@ protected:
|
|||||||
{
|
{
|
||||||
// lwIP's tcp_output doc: "Find out what we can send and send it"
|
// lwIP's tcp_output doc: "Find out what we can send and send it"
|
||||||
// *with respect to Nagle*
|
// *with respect to Nagle*
|
||||||
// more insights: https://lists.gnu.org/archive/html/lwip-users/2017-11/msg00134.html
|
// more info: https://lists.gnu.org/archive/html/lwip-users/2017-11/msg00134.html
|
||||||
tcp_output(_pcb);
|
tcp_output(_pcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user