Project

General

Profile

Feature #97 » lighttpd-1.3.13.selective_cork.2.patch

Patch (without junk) to selectively cork only if deemed necessary -- Christian von Roques <roques - Anonymous, 2005-04-14 22:23

View differences:

lighttpd-1.3.13.hacked/src/network.c 2005-03-14 15:42:58.543182586 -0400
int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq) {
int ret = -1, i;
off_t written = 0;
#ifdef TCP_CORK
int corked = 0;
#endif
server_socket *srv_socket = con->srv_socket;
......
#ifdef TCP_CORK
/* Linux: put a cork into the socket as we want to combine the write() calls */
i = 1;
setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &i, sizeof(i));
if (cq->first->next) {
corked = 1;
setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &corked, sizeof(corked));
}
#endif
if (srv_socket->is_ssl) {
......
}
#ifdef TCP_CORK
i = 0;
setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &i, sizeof(i));
if (corked) {
corked = 0;
setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &corked, sizeof(corked));
}
#endif
written = con->bytes_written - written;
(2-2/2)