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/ServerReader.java | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
index c238e19..4b5037d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
@@ -272,6 +272,18 @@
ChangeTimeHeartbeatMsg cthbMsg = (ChangeTimeHeartbeatMsg) msg;
replicationServerDomain.processChangeTimeHeartbeatMsg(handler,
cthbMsg);
+ } else if (msg instanceof StopMsg)
+ {
+ // Peer server is properly disconnecting: go out of here to
+ // properly close the server handler going to finally block.
+ if (debugEnabled())
+ {
+ TRACER.debugInfo(handler.toString() + " has properly " +
+ "disconnected from this replication server " +
+ Integer.toString(replicationServerDomain.getReplicationServer().
+ getServerId()));
+ }
+ return;
} else if (msg == null)
{
/*
@@ -308,7 +320,7 @@
" reader IO EXCEPTION for serverID=" + serverId + " " +
this + " " +
stackTraceToSingleLineString(e) + " " + e.getLocalizedMessage());
- errMessage = NOTE_SERVER_DISCONNECT.get(handler.toString(),
+ errMessage = ERR_SERVER_BADLY_DISCONNECTED.get(handler.toString(),
Integer.toString(replicationServerDomain.
getReplicationServer().getServerId()));
logError(errMessage);
@@ -346,7 +358,7 @@
finally
{
/*
- * The thread only exit the loop above is some error condition
+ * The thread only exits the loop above if some error condition
* happen.
* Attempt to close the socket and stop the server handler.
*/
@@ -357,6 +369,19 @@
"In RS " + replicationServerDomain.getReplicationServer().
getMonitorInstanceName() +
this + " is closing the session");
+ if (handler.getProtocolVersion() >=
+ 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
+ }
+ }
session.close();
} catch (IOException e)
{
--
Gitblit v1.10.0