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/ServerWriter.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
index 37579ba..80ad900 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
@@ -41,6 +41,8 @@
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.replication.common.ServerStatus;
 import org.opends.server.replication.protocol.ProtocolSession;
+import org.opends.server.replication.protocol.ProtocolVersion;
+import org.opends.server.replication.protocol.StopMsg;
 import org.opends.server.replication.protocol.UpdateMsg;
 
 
@@ -198,7 +200,7 @@
        * The remote host has disconnected and this particular Tree is going to
        * be removed, just ignore the exception and let the thread die as well
        */
-      errMessage = NOTE_SERVER_DISCONNECT.get(handler.toString(),
+      errMessage = ERR_SERVER_BADLY_DISCONNECTED.get(handler.toString(),
         Integer.toString(replicationServerDomain.
         getReplicationServer().getServerId()));
       logError(errMessage);
@@ -209,7 +211,7 @@
        * The remote host has disconnected and this particular Tree is going to
        * be removed, just ignore the exception and let the thread die as well
        */
-      errMessage = NOTE_SERVER_DISCONNECT.get(handler.toString(),
+      errMessage = ERR_SERVER_BADLY_DISCONNECTED.get(handler.toString(),
         Integer.toString(replicationServerDomain.
         getReplicationServer().getServerId()));
       logError(errMessage);
@@ -225,6 +227,18 @@
       logError(errMessage);
     }
     finally {
+      if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
+      {
+        // V4 protocol introduces a StopMsg to properly end
+        // communications
+        try
+        {
+          session.publish(new StopMsg());
+        } catch (IOException ioe)
+        {
+          // Anyway, going to close session, so nothing to do
+        }
+      }
       try
       {
         session.close();

--
Gitblit v1.10.0