From 3a9e211d36ee94ff99941943b3b51e0f768624f5 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Fri, 06 Nov 2009 09:11:40 +0000
Subject: [PATCH] In order to support a more clever algorithm for the DS to choose his RS,  we introduce:

---
 opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
index 91015f3..42b255c 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -240,6 +240,9 @@
 
         logTopoHandshakeSNDandRCV(outTopoMsg, inTopoMsg);
 
+        // Create the monitoring publisher for the domain if not already started
+        createMonitoringPublisher();
+
         // FIXME: i think this should be done for all protocol version !!
         // not only those > V1
         registerIntoDomain();
@@ -408,6 +411,10 @@
         // other servers.
       }
 
+
+      // Create the monitoring publisher for the domain if not already started
+      createMonitoringPublisher();
+
       registerIntoDomain();
 
       // Process TopologyMsg sent by remote RS: store matching new info
@@ -497,7 +504,18 @@
     // Remote RS sent his topo msg
     TopologyMsg inTopoMsg = (TopologyMsg) msg;
 
-    // CONNECTION WITH A RS
+    // Store remore RS weight if it has one
+    if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
+    {
+      // List should only contain RS info for sender
+      RSInfo rsInfo = inTopoMsg.getRsList().get(0);
+      weight = rsInfo.getWeight();
+    }
+    else
+    {
+      // Remote RS uses protocol version prior to 4 : use default value for
+      // weight: 1
+    }
 
     // if the remote RS and the local RS have the same genID
     // then it's ok and nothing else to do
@@ -646,6 +664,7 @@
     RSInfo rsInfo = rsInfos.get(0);
     generationId = rsInfo.getGenerationId();
     groupId = rsInfo.getGroupId();
+    weight = rsInfo.getWeight();
 
     /**
      * Store info for DSs connected to the peer RS

--
Gitblit v1.10.0