]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/config.c
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / config.c
index abc379f198b7af264f8264178fc7540f2816e181..d1c4a9617ae5ed2083d7fa61d7e26d015dcdb40a 100644 (file)
@@ -1283,7 +1283,7 @@ static slap_verbmasks versionkey[] = {
        { BER_BVNULL, 0 }
 };
 
-static int 
+int
 slap_keepalive_parse(
        struct berval *val,
        void *bc,
@@ -1925,6 +1925,29 @@ int bindconf_tls_set( slap_bindconf *bc, LDAP *ld )
 }
 #endif
 
+/*
+ * set connection keepalive options
+ */
+void
+slap_client_keepalive(LDAP *ld, slap_keepalive *sk)
+{
+       if (!sk) return;
+
+       if ( sk->sk_idle ) {
+               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_IDLE, &sk->sk_idle );
+       }
+
+       if ( sk->sk_probes ) {
+               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_PROBES, &sk->sk_probes );
+       }
+
+       if ( sk->sk_interval ) {
+               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_INTERVAL, &sk->sk_interval );
+       }
+
+       return;
+}
+
 /*
  * connect to a client using the bindconf data
  * note: should move "version" into bindconf...
@@ -1963,17 +1986,8 @@ slap_client_connect( LDAP **ldp, slap_bindconf *sb )
                ldap_set_option( ld, LDAP_OPT_NETWORK_TIMEOUT, &tv );
        }
 
-       if ( sb->sb_keepalive.sk_idle ) {
-               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_IDLE, &sb->sb_keepalive.sk_idle );
-       }
-
-       if ( sb->sb_keepalive.sk_probes ) {
-               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_PROBES, &sb->sb_keepalive.sk_probes );
-       }
-
-       if ( sb->sb_keepalive.sk_interval ) {
-               ldap_set_option( ld, LDAP_OPT_X_KEEPALIVE_INTERVAL, &sb->sb_keepalive.sk_interval );
-       }
+       /* setting network keepalive options */
+       slap_client_keepalive(ld, &sb->sb_keepalive);
 
 #ifdef HAVE_TLS
        if ( sb->sb_tls_do_init ) {