Mercurial > dovecot > core-2.2
diff src/lib/net.c @ 21041:13a159cfd232
lib: Created net_set_tcp_nodelay(), which enables the TCP_NODELAY socket option.
This disables the TCP Nagle algorithm.
author | Stephan Bosch <stephan@dovecot.fi> |
---|---|
date | Thu, 16 Jun 2016 22:01:06 +0200 |
parents | 06fd5e4f123e |
children | 3f83d38ba0b3 |
line wrap: on
line diff
--- a/src/lib/net.c Mon May 23 02:36:10 2016 +0200 +++ b/src/lib/net.c Thu Jun 16 22:01:06 2016 +0200 @@ -376,6 +376,13 @@ #endif } +int net_set_tcp_nodelay(int fd, bool nodelay) +{ + int val = nodelay; + + return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); +} + int net_set_send_buffer_size(int fd, size_t size) { int opt;