]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8849 Introduce (un)pause callbacks to backends
authorOndřej Kuzník <ondra@openldap.org>
Wed, 9 May 2018 14:02:34 +0000 (15:02 +0100)
committerOndřej Kuzník <ondra@openldap.org>
Fri, 19 Oct 2018 12:08:09 +0000 (13:08 +0100)
servers/slapd/daemon.c
servers/slapd/slap.h

index ff0c569e3669d71e978296da5aa1ce9929ba2d6e..42bb931ca6b9412ac1278db7f0da7ac68077c396 100644 (file)
@@ -3270,13 +3270,46 @@ slap_sig_wake( int sig )
 int
 slap_pause_server( void )
 {
-       return ldap_pvt_thread_pool_pause( &connection_pool );
+       BackendInfo *bi;
+       int rc = LDAP_SUCCESS;
+
+       rc = ldap_pvt_thread_pool_pause( &connection_pool );
+
+       LDAP_STAILQ_FOREACH(bi, &backendInfo, bi_next) {
+               if ( bi->bi_pause ) {
+                       rc = bi->bi_pause( bi );
+                       if ( rc != LDAP_SUCCESS ) {
+                               Debug( LDAP_DEBUG_ANY, "slap_pause_server: "
+                                               "bi_pause failed for backend %s\n",
+                                               bi->bi_type, 0, 0 );
+                               return rc;
+                       }
+               }
+       }
+
+       return rc;
 }
 
 int
 slap_unpause_server( void )
 {
-       return ldap_pvt_thread_pool_resume( &connection_pool );
+       BackendInfo *bi;
+       int rc = LDAP_SUCCESS;
+
+       LDAP_STAILQ_FOREACH(bi, &backendInfo, bi_next) {
+               if ( bi->bi_unpause ) {
+                       rc = bi->bi_unpause( bi );
+                       if ( rc != LDAP_SUCCESS ) {
+                               Debug( LDAP_DEBUG_ANY, "slap_unpause_server: "
+                                               "bi_unpause failed for backend %s\n",
+                                               bi->bi_type, 0, 0 );
+                               return rc;
+                       }
+               }
+       }
+
+       rc = ldap_pvt_thread_pool_resume( &connection_pool );
+       return rc;
 }
 
 
index b51b5571b652e508aed5b31eee5b2ce9e930cc24..ef2d0b2af53f4719210375ff6f2e2cef7034f536 100644 (file)
@@ -1992,6 +1992,8 @@ struct BackendDB {
 typedef int (BI_bi_func) LDAP_P((BackendInfo *bi));
 typedef BI_bi_func BI_init;
 typedef BI_bi_func BI_open;
+typedef BI_bi_func BI_pause;
+typedef BI_bi_func BI_unpause;
 typedef BI_bi_func BI_close;
 typedef BI_bi_func BI_destroy;
 typedef int (BI_config) LDAP_P((BackendInfo *bi,
@@ -2251,6 +2253,8 @@ struct BackendInfo {
        BI_init *bi_init;
        BI_config       *bi_config;
        BI_open *bi_open;
+       BI_pause        *bi_pause;
+       BI_unpause      *bi_unpause;
        BI_close        *bi_close;
        BI_destroy      *bi_destroy;