]> git.sur5r.net Git - openldap/commitdiff
Make slurpd work when restarting in one-shot mode.
authorRandy Kunkee <kunkee@openldap.org>
Wed, 26 Apr 2000 01:03:47 +0000 (01:03 +0000)
committerRandy Kunkee <kunkee@openldap.org>
Wed, 26 Apr 2000 01:03:47 +0000 (01:03 +0000)
servers/slurpd/main.c

index 1510f21825b978a2226044f9f29c9d5c90b4c3d3..6b517f57507d05f6a7d8ee0102f83fd6d5b8ba32 100644 (file)
@@ -101,15 +101,8 @@ main(
 #endif /* LDAP_DEBUG */
        lutil_detach( 0, 0 );
 
-       /* initialize thread package */
-       ldap_pvt_thread_initialize();
-
-    /*
-     * Start threads - one thread for each replica
-     */
-    for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) {
-       start_replica_thread( sglob->replicas[ i ]);
-    }
+    /* initialize thread package */
+    ldap_pvt_thread_initialize();
 
     /*
      * Start the main file manager thread (in fm.c).
@@ -123,10 +116,26 @@ main(
 
     }
 
+    /*
+     * wait for fm to finish if in oneshot mode
+     */
+    if ( sglob->one_shot_mode ) {
+       ldap_pvt_thread_join( sglob->fm_tid, (void *) NULL );
+    }
+
+    /*
+     * Start threads - one thread for each replica
+     */
+    for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) {
+       start_replica_thread( sglob->replicas[ i ]);
+    }
+
     /*
      * Wait for the fm thread to finish.
      */
-    ldap_pvt_thread_join( sglob->fm_tid, (void *) NULL );
+    if ( !sglob->one_shot_mode ) {
+       ldap_pvt_thread_join( sglob->fm_tid, (void *) NULL );
+    }
 
     /*
      * Wait for the replica threads to finish.