1
1
/* os-ip.c -- platform-specific TCP & UDP related code */
2
/* $OpenLDAP: pkg/ldap/libraries/libldap/os-ip.c,v 1.118.2.15 2009/02/17 21:02:51 quanah Exp $ */
2
/* $OpenLDAP: pkg/ldap/libraries/libldap/os-ip.c,v 1.118.2.19 2009/08/14 20:31:32 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
5
* Copyright 1998-2009 The OpenLDAP Foundation.
142
142
"setsockopt(%d, SO_KEEPALIVE) failed (ignored).\n",
145
if ( ld->ld_options.ldo_keepalive_idle > 0 )
148
if ( setsockopt( s, IPPROTO_TCP, TCP_KEEPIDLE,
149
(void*) &ld->ld_options.ldo_keepalive_idle,
150
sizeof(ld->ld_options.ldo_keepalive_idle) ) == AC_SOCKET_ERROR )
152
osip_debug( ld, "ldap_prepare_socket: "
153
"setsockopt(%d, TCP_KEEPIDLE) failed (ignored).\n",
157
osip_debug( ld, "ldap_prepare_socket: "
158
"sockopt TCP_KEEPIDLE not supported on this system.\n",
160
#endif /* TCP_KEEPIDLE */
162
if ( ld->ld_options.ldo_keepalive_probes > 0 )
165
if ( setsockopt( s, IPPROTO_TCP, TCP_KEEPCNT,
166
(void*) &ld->ld_options.ldo_keepalive_probes,
167
sizeof(ld->ld_options.ldo_keepalive_probes) ) == AC_SOCKET_ERROR )
169
osip_debug( ld, "ldap_prepare_socket: "
170
"setsockopt(%d, TCP_KEEPCNT) failed (ignored).\n",
174
osip_debug( ld, "ldap_prepare_socket: "
175
"sockopt TCP_KEEPCNT not supported on this system.\n",
177
#endif /* TCP_KEEPCNT */
179
if ( ld->ld_options.ldo_keepalive_interval > 0 )
182
if ( setsockopt( s, IPPROTO_TCP, TCP_KEEPINTVL,
183
(void*) &ld->ld_options.ldo_keepalive_interval,
184
sizeof(ld->ld_options.ldo_keepalive_interval) ) == AC_SOCKET_ERROR )
186
osip_debug( ld, "ldap_prepare_socket: "
187
"setsockopt(%d, TCP_KEEPINTVL) failed (ignored).\n",
191
osip_debug( ld, "ldap_prepare_socket: "
192
"sockopt TCP_KEEPINTVL not supported on this system.\n",
194
#endif /* TCP_KEEPINTVL */
145
196
#endif /* SO_KEEPALIVE */
146
197
#ifdef TCP_NODELAY
147
198
if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY,