Disable Nagle in iprop master and slave

This commit is contained in:
Viktor Dukhovni
2019-09-21 18:29:12 -04:00
committed by Nico Williams
parent 0334472ab5
commit 96fd393d29
5 changed files with 33 additions and 0 deletions

View File

@@ -355,6 +355,7 @@ AC_CHECK_HEADERS([\
maillock.h \
netgroup.h \
netinet/in6_machtypes.h \
netinet/tcp.h \
pthread.h \
pty.h \
sac.h \

View File

@@ -653,6 +653,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
/* Define to 1 if you have the <netinet/in.h> header file. */
/* #define HAVE_NETINET_IN_H 1 */
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/* #define HAVE_NETINET_TCP_H 1 */
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
/* #define HAVE_NETINET_IN_SYSTM_H 1 */

View File

@@ -319,6 +319,20 @@ add_slave (krb5_context context, krb5_keytab keytab, slave **root,
* own krb5_recvauth().
*/
socket_set_nonblocking(s->fd, 1);
/*
* We write message lengths separately from the payload, and may do
* back-to-back small writes when flushing pending input and then a new
* update. Avoid Nagle delays.
*/
#if defined(IPPROTO_TCP) && defined(TCP_NODELAY)
{
int nodelay = 1;
(void) setsockopt(s->fd, IPPROTO_TCP, TCP_NODELAY,
(void *)&nodelay, sizeof(nodelay));
}
#endif
krb5_free_principal (context, server);
if (ret) {
krb5_warn (context, ret, "krb5_recvauth");

View File

@@ -99,6 +99,15 @@ connect_to_master (krb5_context context, const char *master,
if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)) < 0)
krb5_warn(context, errno, "setsockopt(SO_KEEPALIVE) failed");
/*
* We write message lengths separately from the payload, avoid Nagle
* delays.
*/
#if defined(IPPROTO_TCP) && defined(TCP_NODELAY)
(void) setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
(void *)&one, sizeof(one));
#endif
return s;
}

View File

@@ -67,6 +67,12 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif