]> git.sur5r.net Git - openldap/commitdiff
use macros for fake connid
authorQuanah Gibson-Mount <quanah@openldap.org>
Sun, 22 Nov 2009 17:28:23 +0000 (17:28 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Sun, 22 Nov 2009 17:28:23 +0000 (17:28 +0000)
servers/slapd/backend.c
servers/slapd/connection.c
servers/slapd/slap.h
servers/slapd/syncrepl.c
tests/data/monitor1.out

index b003354219566b2c49ee8321537d4f698eef2960..10320083539bce051c684869cd3659fb2bb649dc 100644 (file)
@@ -762,7 +762,7 @@ be_shadow_update( Operation *op )
        /* This assumes that all internal ops (connid <= -1000) on a syncrepl
         * database are syncrepl operations.
         */
-       return (( SLAP_SYNC_SHADOW( op->o_bd ) && op->o_connid <= -1000 ) ||
+       return ( ( SLAP_SYNC_SHADOW( op->o_bd ) && SLAPD_SYNC_IS_SYNCCONN( op->o_connid ) ) ||
                ( SLAP_SHADOW( op->o_bd ) && be_isupdate_dn( op->o_bd, &op->o_ndn ) ) );
 }
 
index 2f426d6106252d73aea57bf97d7e2c2f6479347b..7f8331f5329875b6bc8b486f7377b5f00383ac7b 100644 (file)
@@ -48,7 +48,7 @@ static ldap_pvt_thread_mutex_t connections_mutex;
 static Connection *connections = NULL;
 
 static ldap_pvt_thread_mutex_t conn_nextid_mutex;
-static unsigned long conn_nextid = 0;
+static unsigned long conn_nextid = SLAPD_SYNC_SYNCCONN_OFFSET;
 
 static const char conn_lost_str[] = "connection lost";
 
index 6015dbf8377bf6ccd76be9b2204e7bef1e8a3741..076b898a5b6ac60b4f2434d98939a6109bc3ac57 100644 (file)
@@ -1703,6 +1703,13 @@ struct syncinfo_s;
 
 #define SLAP_SYNC_RID_MAX      999
 #define SLAP_SYNC_SID_MAX      4095    /* based on liblutil/csn.c field width */
+
+/* fake conn connid constructed as rid; real connids start
+ * at SLAPD_SYNC_CONN_OFFSET */
+#define SLAPD_SYNC_SYNCCONN_OFFSET (SLAP_SYNC_RID_MAX + 1)
+#define SLAPD_SYNC_IS_SYNCCONN(connid) ((connid) < SLAPD_SYNC_SYNCCONN_OFFSET)
+#define SLAPD_SYNC_RID2SYNCCONN(rid) (rid)
+
 #define SLAP_SYNCUUID_SET_SIZE 256
 
 struct sync_cookie {
index 414ab32506e4f41169fbbf79df0c18ea53357073..a9b3d7150bf5231a4ea035c4845da4cadfe1395c 100644 (file)
@@ -1354,7 +1354,7 @@ do_syncrepl(
        connection_fake_init( &conn, &opbuf, ctx );
        op = &opbuf.ob_op;
        /* o_connids must be unique for slap_graduate_commit_csn */
-       op->o_connid = -1000 - si->si_rid;
+       op->o_connid = SLAPD_SYNC_RID2SYNCCONN(si->si_rid);
 
        op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
        be = si->si_be;
index 06beecc8911a140cd8a3e8e5d48cb4b6c450fd7c..59192485ae1d9a72c9738188166e0b725bc61f30 100644 (file)
@@ -1,4 +1,4 @@
-dn: cn=Connection 1,cn=Connections,cn=Monitor
+dn: cn=Connection 1001,cn=Connections,cn=Monitor
 structuralObjectClass: monitorConnection
 monitorConnectionProtocol: 3
 monitorConnectionOpsReceived: 2
@@ -11,7 +11,7 @@ monitorConnectionWrite: 0
 monitorConnectionMask: rx
 monitorConnectionListener: ldap://localhost:@PORT1@/
 monitorConnectionLocalAddress: IP=127.0.0.1:@PORT1@
-entryDN: cn=Connection 1,cn=Connections,cn=Monitor
+entryDN: cn=Connection 1001,cn=Connections,cn=Monitor
 
 dn: cn=Connections,cn=Monitor
 structuralObjectClass: monitorContainer