From c02dd7f87e9ba574f06e5cc1eb36ebeb76b9f446 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Thu, 08 Oct 2009 16:02:17 +0000
Subject: [PATCH] - Addition of ReplServerStartDSMsg now sent to a DS connecting to a RS  in handshake phase instead of a ReplServerStartMsg. ReplServerStartDSMsg  contains same thing as ReplServerStartMsg but also contains

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
index 8693dd9..6ce4627 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -121,6 +121,34 @@
   }
 
   /**
+   * Send the ReplServerStartMsg to the remote RS.
+   * @param requestedProtocolVersion The provided protocol version.
+   * @return The ReplServerStartMsg sent.
+   * @throws IOException When an exception occurs.
+   */
+  private ReplServerStartMsg sendStartToRemote(short requestedProtocolVersion)
+  throws IOException
+  {
+    ReplServerStartMsg outReplServerStartMsg
+    = new ReplServerStartMsg(
+        replicationServerId,
+        replicationServerURL,
+        getServiceId(),
+        maxRcvWindow,
+        replicationServerDomain.getDbServerState(),
+        protocolVersion,
+        localGenerationId,
+        sslEncryption,
+        getLocalGroupId(),
+        replicationServerDomain.
+        getReplicationServer().getDegradedStatusThreshold());
+
+    session.publish(outReplServerStartMsg, requestedProtocolVersion);
+
+    return outReplServerStartMsg;
+  }
+
+  /**
    * Creates a new handler object to a remote replication server.
    * @param session The session with the remote RS.
    * @param queueSize The queue size to manage updates to that RS.
@@ -262,6 +290,7 @@
       // lock with timeout
       lockDomain(true);
 
+      this.localGenerationId = replicationServerDomain.getGenerationId();
       ReplServerStartMsg outReplServerStartMsg =
         sendStartToRemote(protocolVersion);
 
@@ -389,6 +418,14 @@
       super.finalizeStart();
 
     }
+    catch(IOException ioe) {
+      Message errMessage = ERR_RS_DISCONNECTED_DURING_HANDSHAKE.get(
+        Integer.toString(inReplServerStartMsg.getServerId()),
+        Integer.toString(replicationServerDomain.getReplicationServer().
+        getServerId()));
+      logError(errMessage);
+      abortStart(errMessage);
+    }
     catch(DirectoryException de)
     {
       abortStart(de.getMessageObject());
@@ -425,7 +462,7 @@
   throws IOException
   {
     TopologyMsg outTopoMsg = replicationServerDomain.createTopologyMsgForRS();
-    session.publish(outTopoMsg);
+    session.publish(outTopoMsg, protocolVersion);
     return outTopoMsg;
   }
 

--
Gitblit v1.10.0