From 6ee1440f6f56ac066f97383315b2798287f0821a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 23 Mar 2011 22:27:01 +0000
Subject: [PATCH] Fix issue OpenDJ-95: Socket leak and constant disconnect/reconnect when a directory server can no longer reach its connected replication server

---
 opends/src/server/org/opends/server/replication/server/ServerReader.java |   27 +++++----------------------
 1 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ServerReader.java b/opends/src/server/org/opends/server/replication/server/ServerReader.java
index f7b8356..7517b25 100644
--- a/opends/src/server/org/opends/server/replication/server/ServerReader.java
+++ b/opends/src/server/org/opends/server/replication/server/ServerReader.java
@@ -341,32 +341,15 @@
     finally
     {
       /*
-       * The thread only exits the loop above if some error condition
-       * happen.
+       * The thread only exits the loop above if some error condition happen.
        * Attempt to close the socket and stop the server handler.
        */
-      try
+      if (debugEnabled())
       {
-        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
-          }
-        }
-        if (debugEnabled())
-          TRACER.debugInfo("In " + this.getName() + " closing the session");
-        session.close();
-      } catch (IOException e)
-      {
-      // ignore
+        TRACER.debugInfo("In " + this.getName()
+            + " closing the session");
       }
+      session.close();
       handler.doStop();
       if (debugEnabled())
       {

--
Gitblit v1.10.0