]> git.sur5r.net Git - openldap/commitdiff
Implement TCP_NODELAY on both client and server side.
authorKurt Zeilenga <kurt@openldap.org>
Thu, 22 Jul 1999 21:49:35 +0000 (21:49 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 22 Jul 1999 21:49:35 +0000 (21:49 +0000)
include/ac/socket.h
libraries/libldap/os-ip.c
servers/slapd/daemon.c

index 45554cbd5a0208650a81e36733054febd212610d..8bf30d24a0bb8280c9254f67a75696d5a8a35053 100644 (file)
@@ -26,6 +26,7 @@
 #endif
 
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
index 489c55e415f8f6bdd13f426ad1cf958f0f3a1e6d..4d6e6c8db7dd255ae0bc8c4146c7f108dcc78c37 100644 (file)
@@ -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 ) {
index f17a0df516572d56979b737fcab8ca4f948c891e..efa1b38c759e094f6978b8c947017162f3bff2a5 100644 (file)
@@ -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" );