mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 17:19:43 -05:00
apply slightly revised patch for SO_KEEPALIVE (ITS#4708)
This commit is contained in:
parent
b1a2be99c6
commit
387c21c7dd
1 changed files with 17 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue