]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/st.c
Ensure that global plugins are called after backend-specific plugins
[openldap] / servers / slurpd / st.c
index 5d2be8d2fac6851d8eb20b0fd594147690866c40..e2a00299b6ea444204a39ce7557b840f4ab5b6e4 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
@@ -97,9 +97,15 @@ St_write (
        if (( rc = acquire_lock( sglob->slurpd_status_file, &(st->st_fp),
                &(st->st_lfp))) < 0 ) {
            if ( !st->st_err_logged ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, ERR, "St_write: "
+                       "Error: cannot open status file \"%s\":%s\n",
+                       sglob->slurpd_status_file, sys_errlist[ errno ], 0 );
+#else
                Debug( LDAP_DEBUG_ANY,
                        "Error: cannot open status file \"%s\": %s\n",
                        sglob->slurpd_status_file, sys_errlist[ errno ], 0 );
+#endif
                st->st_err_logged = 1;
                ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
                return -1;
@@ -177,15 +183,26 @@ St_read(
         * File doesn't exist, so create it and return.
         */
        if (( fp = fopen( sglob->slurpd_status_file, "w" )) == NULL ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, ERR, "St_write: "
+                       "Error: cannot create status file \"%s\"\n",
+                   sglob->slurpd_status_file, 0, 0 );
+#else
            Debug( LDAP_DEBUG_ANY, "Error: cannot create status file \"%s\"\n",
                    sglob->slurpd_status_file, 0, 0 );
+#endif
            ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
            return -1;
        }
        (void) fclose( fp );
        ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
+#ifdef NEW_LOGGING
+       LDAP_LOG ( SLURPD, DETAIL1, "St_write: "
+               "No status file found, defaulting values\n", 0, 0, 0 );
+#else
        Debug( LDAP_DEBUG_ARGS, "No status file found, defaulting values\n",
                0, 0, 0 );
+#endif
        return 0;
     }
     if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
@@ -230,12 +247,23 @@ St_read(
            char tbuf[ 255 ];
            sprintf( tbuf, "%s:%s (timestamp %s.%s)", hostname, port,
                    timestamp, seq );
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, DETAIL1, "St_write: "
+                       "Retrieved state information for %s\n", tbuf, 0, 0 );
+#else
            Debug( LDAP_DEBUG_ARGS,
                    "Retrieved state information for %s\n", tbuf, 0, 0 );
+#endif
        } else {
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, WARNING, "St_write: "
+                       "Warning: saved state for %s:%s, not a known replica\n", 
+                       hostname, port, 0 );
+#else
            Debug(  LDAP_DEBUG_ANY,
                    "Warning: saved state for %s:%s, not a known replica\n",
                    hostname, port, 0 );
+#endif
        }
     }
     (void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);