From: Kurt Zeilenga Date: Sat, 21 Oct 2006 06:56:52 +0000 (+0000) Subject: ITS#2708 keepalive patch X-Git-Tag: OPENLDAP_REL_ENG_2_3_28~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=01ff17c077f70a36022bd732f53e45ac16b6c730;p=openldap ITS#2708 keepalive patch --- diff --git a/CHANGES b/CHANGES index 5e55c6d1f9..619ab9acff 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ OpenLDAP 2.3 Change Log OpenLDAP 2.3.28 Release Fixed libldap ldap.conf max line length (ITS#4669) + Fixed libldap use keepalive for syncrepl (ITS#4708) Fixed liblutil LDIF CR/LF parsing bug (ITS#4635) Fixed librewrite LDAP map parsing bug Fixed librewrite map double free bug diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 3f428ae980..fdcea293f8 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -123,20 +123,31 @@ ldap_pvt_close_socket(LDAP *ld, int s) static int ldap_int_prepare_socket(LDAP *ld, int s, int proto ) { - osip_debug(ld, "ldap_prepare_socket: %d\n", s,0,0); + osip_debug( ld, "ldap_prepare_socket: %d\n", s, 0, 0 ); -#ifdef TCP_NODELAY - if( proto == LDAP_PROTO_TCP ) { +#if defined( SO_KEEPALIVE ) || defined( TCP_NODELAY ) + if ( proto == LDAP_PROTO_TCP ) { int dummy = 1; +#ifdef SO_KEEPALIVE + if ( setsockopt( s, SOL_SOCKET, SO_KEEPALIVE, + (char*) &dummy, sizeof(dummy) ) == AC_SOCKET_ERROR ) + { + osip_debug( ld, "ldap_prepare_socket: " + "setsockopt(%d, SO_KEEPALIVE) failed (ignored).\n", + s, 0, 0 ); + } +#endif /* SO_KEEPALIVE */ +#ifdef TCP_NODELAY if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY, (char*) &dummy, sizeof(dummy) ) == AC_SOCKET_ERROR ) { - osip_debug(ld, "ldap_prepare_socket: " + osip_debug( ld, "ldap_prepare_socket: " "setsockopt(%d, TCP_NODELAY) failed (ignored).\n", - s, 0, 0); + s, 0, 0 ); } +#endif /* TCP_NODELAY */ } -#endif +#endif /* SO_KEEPALIVE || TCP_NODELAY */ return 0; }