/* 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 ) ) );
}
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";
#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 {
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;
-dn: cn=Connection 1,cn=Connections,cn=Monitor
+dn: cn=Connection 1001,cn=Connections,cn=Monitor
structuralObjectClass: monitorConnection
monitorConnectionProtocol: 3
monitorConnectionOpsReceived: 2
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