From 99480fcbcb68be6a357f6218668feab697e1a93d Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 07 Jul 2009 14:55:26 +0000
Subject: [PATCH] Fix for 4096 MonitorMsg is not compatible with replication version

---
 opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 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 8d5d9f6..019cbf5 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -85,6 +85,7 @@
     {
       protocolVersion = ProtocolVersion.minWithCurrent(
           inReplServerStartMsg.getVersion());
+      session.setProtocolVersion(protocolVersion);
       generationId = inReplServerStartMsg.getGenerationId();
       serverId = inReplServerStartMsg.getServerId();
       serverURL = inReplServerStartMsg.getServerURL();
@@ -163,13 +164,14 @@
     try
     {
       //
-      lockDomain(false); // notimeout
+      lockDomain(false); // no timeout
 
       // we are the initiator and decides of the encryption
       boolean sessionInitiatorSSLEncryption = this.initSslEncryption;
 
       // Send start
-      ReplServerStartMsg outReplServerStartMsg = sendStartToRemote((short)-1);
+      ReplServerStartMsg outReplServerStartMsg =
+        sendStartToRemote(ProtocolVersion.getCurrentVersion());
 
       // Wait answer
       ReplicationMsg msg = session.receive();
@@ -260,20 +262,13 @@
       // lock with timeout
       lockDomain(true);
 
-      short reqVersion = -1;
-      if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1)
-      {
-        // We support connection from a V1 RS, send PDU with V1 form
-        reqVersion = ProtocolVersion.REPLICATION_PROTOCOL_V1;
-      }
-
-      // send start to remote
-      ReplServerStartMsg outReplServerStartMsg = sendStartToRemote(reqVersion);
+      ReplServerStartMsg outReplServerStartMsg =
+        sendStartToRemote(protocolVersion);
 
       // log
       logStartHandshakeRCVandSND(inReplServerStartMsg, outReplServerStartMsg);
 
-      // until here session is encrypted then it depends on the negociation
+      // until here session is encrypted then it depends on the negotiation
       // The session initiator decides whether to use SSL.
       if (!sessionInitiatorSSLEncryption)
         session.stopEncryption();

--
Gitblit v1.10.0