~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to libraries/libldap/os-ip.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-09-07 13:41:10 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090907134110-jsdrvn0atu1fex4m
Tags: upstream-2.4.18
ImportĀ upstreamĀ versionĀ 2.4.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/>.
4
4
 *
5
5
 * Copyright 1998-2009 The OpenLDAP Foundation.
142
142
                                "setsockopt(%d, SO_KEEPALIVE) failed (ignored).\n",
143
143
                                s, 0, 0 );
144
144
                }
 
145
                if ( ld->ld_options.ldo_keepalive_idle > 0 )
 
146
                {
 
147
#ifdef TCP_KEEPIDLE
 
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 )
 
151
                        {
 
152
                                osip_debug( ld, "ldap_prepare_socket: "
 
153
                                        "setsockopt(%d, TCP_KEEPIDLE) failed (ignored).\n",
 
154
                                        s, 0, 0 );
 
155
                        }
 
156
#else
 
157
                        osip_debug( ld, "ldap_prepare_socket: "
 
158
                                        "sockopt TCP_KEEPIDLE not supported on this system.\n", 
 
159
                                        0, 0, 0 );
 
160
#endif /* TCP_KEEPIDLE */
 
161
                }
 
162
                if ( ld->ld_options.ldo_keepalive_probes > 0 )
 
163
                {
 
164
#ifdef TCP_KEEPCNT
 
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 )
 
168
                        {
 
169
                                osip_debug( ld, "ldap_prepare_socket: "
 
170
                                        "setsockopt(%d, TCP_KEEPCNT) failed (ignored).\n",
 
171
                                        s, 0, 0 );
 
172
                        }
 
173
#else
 
174
                        osip_debug( ld, "ldap_prepare_socket: "
 
175
                                        "sockopt TCP_KEEPCNT not supported on this system.\n", 
 
176
                                        0, 0, 0 );
 
177
#endif /* TCP_KEEPCNT */
 
178
                }
 
179
                if ( ld->ld_options.ldo_keepalive_interval > 0 )
 
180
                {
 
181
#ifdef TCP_KEEPINTVL
 
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 )
 
185
                        {
 
186
                                osip_debug( ld, "ldap_prepare_socket: "
 
187
                                        "setsockopt(%d, TCP_KEEPINTVL) failed (ignored).\n",
 
188
                                        s, 0, 0 );
 
189
                        } 
 
190
#else
 
191
                        osip_debug( ld, "ldap_prepare_socket: "
 
192
                                        "sockopt TCP_KEEPINTVL not supported on this system.\n", 
 
193
                                        0, 0, 0 );
 
194
#endif /* TCP_KEEPINTVL */
 
195
                }
145
196
#endif /* SO_KEEPALIVE */
146
197
#ifdef TCP_NODELAY
147
198
                if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY,