]> git.sur5r.net Git - openldap/commitdiff
ldap-int.h
authorHallvard Furuseth <hallvard@openldap.org>
Tue, 13 Jul 1999 06:21:14 +0000 (06:21 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Tue, 13 Jul 1999 06:21:14 +0000 (06:21 +0000)
libraries/libldap/init.c
libraries/libldap/os-ip.c

index ec2ca209295139cb9e2325a335a5475b1d7795cf..4e45c7554ad7bbce9311d9ab2f3eb29ac6f78807 100644 (file)
@@ -290,6 +290,8 @@ void ldap_int_initialize( void )
        }
 
        ldap_int_utils_init();
+       if ( ldap_int_tblsize == 0 )
+               ldap_int_ip_init();
 
        gopts.ldo_version =     LDAP_VERSION2;
        gopts.ldo_deref =       LDAP_DEREF_NEVER;
index b17e71a58fd78657f56154c5ff8152dd75ce43c2..75c3a7277c154247ea1608981ae42b6004da12ec 100644 (file)
@@ -33,6 +33,9 @@
 
 #include "ldap-int.h"
 
+int ldap_int_tblsize = 0;
+
+
 int
 ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
        int port, int async )
@@ -301,34 +304,41 @@ ldap_free_select_info( void *sip )
 }
 
 
-int
-do_ldap_select( LDAP *ld, struct timeval *timeout )
+void
+ldap_int_ip_init( void )
 {
-       struct selectinfo       *sip;
-       static int              tblsize;
-
-       Debug( LDAP_DEBUG_TRACE, "do_ldap_select\n", 0, 0, 0 );
-
-       if ( tblsize == 0 ) {
+       int tblsize;
 #if defined( HAVE_SYSCONF )
-               tblsize = sysconf( _SC_OPEN_MAX );
+       tblsize = sysconf( _SC_OPEN_MAX );
 #elif defined( HAVE_GETDTABLESIZE )
-               tblsize = getdtablesize();
+       tblsize = getdtablesize();
 #else
-               tblsize = FD_SETSIZE;
+       tblsize = FD_SETSIZE;
 #endif /* !USE_SYSCONF */
 
 #ifdef FD_SETSIZE
-               if( tblsize > FD_SETSIZE ) {
-                       tblsize = FD_SETSIZE;
-               }
+       if( tblsize > FD_SETSIZE )
+               tblsize = FD_SETSIZE;
 #endif /* FD_SETSIZE*/
-       }
+       ldap_int_tblsize = tblsize;
+}
+
+
+int
+do_ldap_select( LDAP *ld, struct timeval *timeout )
+{
+       struct selectinfo       *sip;
+
+       Debug( LDAP_DEBUG_TRACE, "do_ldap_select\n", 0, 0, 0 );
+
+       if ( ldap_int_tblsize == 0 )
+               ldap_int_ip_init();
 
        sip = (struct selectinfo *)ld->ld_selectinfo;
        sip->si_use_readfds = sip->si_readfds;
        sip->si_use_writefds = sip->si_writefds;
        
-       return( select( tblsize, &sip->si_use_readfds, &sip->si_use_writefds,
-           NULL, timeout ));
+       return( select( ldap_int_tblsize,
+                       &sip->si_use_readfds, &sip->si_use_writefds,
+                       NULL, timeout ));
 }