From: Kurt Zeilenga Date: Thu, 22 Jul 1999 21:49:35 +0000 (+0000) Subject: Implement TCP_NODELAY on both client and server side. X-Git-Tag: OPENLDAP_REL_ENG_2_BP~57 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d147e609d2679c6f8252d5ceefcd8bfeece7b5fe;p=openldap Implement TCP_NODELAY on both client and server side. --- diff --git a/include/ac/socket.h b/include/ac/socket.h index 45554cbd5a..8bf30d24a0 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -26,6 +26,7 @@ #endif #include +#include #ifdef HAVE_ARPA_INET_H #include diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 489c55e415..4d6e6c8db7 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -91,6 +91,18 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address, if (( s = socket( AF_INET, SOCK_STREAM, 0 )) < 0 ) { DO_RETURN( -1 ); } +#ifdef TCP_NODELAY + { + int tmp = 1; + if( setsockopt( s, IPPROTO_TCP, TCP_NODELAY, + &tmp, sizeof(tmp) ) == -1 ) + { + Debug( LDAP_DEBUG_ANY, + "setsockopt(TCP_NODELAY failed on %d\n", + s, 0, 0 ); + } + } +#endif #ifdef notyet status = 1; if ( async && ioctl( s, FIONBIO, (caddr_t)&status ) == -1 ) { diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index f17a0df516..efa1b38c75 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -312,7 +312,7 @@ open_listener( { int err = errno; Debug( LDAP_DEBUG_ANY, - "slapd(%ld): setsockopt() failed errno %d (%s)\n", + "slapd(%ld): setsockopt(SO_REUSEADDR) failed errno %d (%s)\n", (long) l.sl_sd, err, err > -1 && err < sys_nerr ? sys_errlist[err] : "unknown" ); @@ -325,7 +325,20 @@ open_listener( { int err = errno; Debug( LDAP_DEBUG_ANY, - "slapd(%ld): setsockopt(KEEPALIVE) failed errno %d (%s)\n", + "slapd(%ld): setsockopt(SO_KEEPALIVE) failed errno %d (%s)\n", + (long) l.sl_sd, err, + err > -1 && err < sys_nerr + ? sys_errlist[err] : "unknown" ); + } +#endif +#ifdef TCP_NODELAY + tmp = 1; + if ( setsockopt( l.sl_sd, IPPROTO_TCP, TCP_NODELAY, + (char *)&tmp, sizeof(tmp) ) ) + { + int err = errno; + Debug( LDAP_DEBUG_ANY, + "slapd(%ld): setsockopt(TCP_NODELAY) failed errno %d (%s)\n", (long) l.sl_sd, err, err > -1 && err < sys_nerr ? sys_errlist[err] : "unknown" );