TCP_CORK and TCP_NODELAY are separate things, but we'll treat them similarly
for our ostream corking API. It was always intended that all data written
inside corking would be delayed until uncork, and immediately sent
afterwards.
This change removes unnecessary extra 40ms delays, which may happen when
proxying.
fstream->no_socket_cork = TRUE;
fstream->socket_cork_set = FALSE;
}
+ if (set) {
+ /* Uncorking - send all the pending data immediately.
+ Remove nodelay immediately afterwards, so if any
+ output is sent outside corking it may get delayed. */
+ net_set_tcp_nodelay(fstream->fd, TRUE);
+ net_set_tcp_nodelay(fstream->fd, FALSE);
+ }
stream->corked = set;
}
}