]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/ri.c
The result set of an EQUALITY search on a SYNTAX_BIN attribute may have been
[openldap] / servers / slurpd / ri.c
index 529438e31b6eb0a603e87cbe9ed1efaad5942583..e28e4468f644e363f84126bb8eed6a6aca773763 100644 (file)
 #include "portable.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ac/signal.h>
 
 #include "slurp.h"
 #include "globals.h"
 
 
-/* External references */
-extern void write_reject LDAP_P(( Ri *, Re *, int, char * ));
-extern void do_nothing LDAP_P(());
-
 /* Forward references */
 static int ismine LDAP_P(( Ri  *, Re  * ));
 static int isnew LDAP_P(( Ri  *, Re  * ));
-void tsleep LDAP_P(( time_t ));
 
 
 /*
@@ -46,15 +42,10 @@ Ri_process(
 {
     Rq         *rq = sglob->rq;
     Re         *re, *new_re;
-    int                i;
     int                rc ;
     char       *errmsg;
 
-#ifdef HAVE_LINUX_THREADS
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else
-    (void) SIGNAL( SIGUSR1, do_nothing );
-#endif
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
     (void) SIGNAL( SIGPIPE, SIG_IGN );
     if ( ri == NULL ) {
        Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 );
@@ -125,6 +116,7 @@ Ri_process(
        while ( !sglob->slurpd_shutdown &&
                ((new_re = re->re_getnext( re )) == NULL )) {
            if ( sglob->one_shot_mode ) {
+               rq->rq_unlock( rq );
                return 0;
            }
            /* No work - wait on condition variable */
@@ -143,7 +135,7 @@ Ri_process(
 
 /*
  * Wake a replication thread which may be sleeping.
- * Send it a SIG(STKFLT|USR1).
+ * Send it a LDAP_SIGUSR1.
  */
 static void
 Ri_wake(
@@ -153,13 +145,8 @@ Ri_wake(
     if ( ri == NULL ) {
        return;
     }
-#ifdef HAVE_LINUX_THREADS
-    pthread_kill( ri->ri_tid, SIGSTKFLT );
-    (void) SIGNAL( SIGSTKFLT, do_nothing );
-#else
-    pthread_kill( ri->ri_tid, SIGUSR1 );
-    (void) SIGNAL( SIGUSR1, do_nothing );
-#endif
+    pthread_kill( ri->ri_tid, LDAP_SIGUSR1 );
+    (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
 }
 
 
@@ -264,5 +251,3 @@ isnew(
     sglob->st->st_unlock( sglob->st );
     return ret;
 }
-
-