]> git.sur5r.net Git - openldap/blob - servers/slurpd/replica.c
Added a "dnattr" case for ACIs (still need to check the ACI OID).
[openldap] / servers / slurpd / replica.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright (c) 1996 Regents of the University of Michigan.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted
7  * provided that this notice is preserved and that due credit is given
8  * to the University of Michigan at Ann Arbor. The name of the University
9  * may not be used to endorse or promote products derived from this
10  * software without specific prior written permission. This software
11  * is provided ``as is'' without express or implied warranty.
12  */
13
14
15 /*
16  * replica.c - code to start up replica threads.
17  */
18
19 #include "portable.h"
20
21 #include <stdio.h>
22
23 #include "slurp.h"
24 #include "globals.h"
25
26
27 /*
28  * Just invoke the Ri's process() member function, and log the start and
29  * finish.
30  */
31 static void *
32 replicate(
33     void        *ri_arg
34 )
35 {
36     Ri          *ri = (Ri *) ri_arg;
37
38     Debug( LDAP_DEBUG_ARGS, "begin replication thread for %s:%d\n",
39             ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port, 0 );
40
41     ri->ri_process( ri );
42
43     Debug( LDAP_DEBUG_ARGS, "end replication thread for %s:%d\n",
44             ri->ri_hostname, ri->ri_port, 0 );
45     return NULL;
46 }
47
48
49
50 /*
51  * Start a detached thread for the given replica.
52  */
53 int
54 start_replica_thread(
55     Ri  *ri
56 )
57 {
58     /* POSIX_THREADS or compatible */
59     if ( ldap_pvt_thread_create( &(ri->ri_tid), 0, replicate,
60             (void *) ri ) != 0 ) {
61         Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" ldap_pvt_thread_create failed\n",
62                 ri->ri_hostname, ri->ri_port, 0 );
63         return -1;
64     }
65
66     return 0;
67 }