From 23b1e20ff9fe938572a0b62ec5a12f12154445df Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 04 Jul 2007 15:12:04 +0000
Subject: [PATCH] The problem was that the publisher thread is stuck waiting for the window to re-open on a connection that has been closed without notifying the publisher.

---
 opends/src/server/org/opends/server/replication/server/ServerHandler.java |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ServerHandler.java b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
index a98df94..7a0f72c 100644
--- a/opends/src/server/org/opends/server/replication/server/ServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -60,6 +60,7 @@
 import org.opends.server.replication.protocol.ReplicationMessage;
 import org.opends.server.replication.protocol.UpdateMessage;
 import org.opends.server.replication.protocol.WindowMessage;
+import org.opends.server.replication.protocol.WindowProbe;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.AttributeValue;
@@ -1372,4 +1373,34 @@
 
     session.publish(msg);
   }
+
+  /**
+   * Process the reception of a WindowProbe message.
+   *
+   * @param  windowProbeMsg The message to process.
+   *
+   * @throws IOException    When the session becomes unavailable.
+   */
+  public void process(WindowProbe windowProbeMsg) throws IOException
+  {
+    if (rcvWindow > 0)
+    {
+      // The LDAP server believes that its window is closed
+      // while it is not, this means that some problem happened in the
+      // window exchange procedure !
+      // lets update the LDAP server with out current window size and hope
+      // that everything will work better in the futur.
+      // TODO also log an error message.
+      WindowMessage msg = new WindowMessage(rcvWindow);
+      session.publish(msg);
+      outAckCount++;
+    }
+    else
+    {
+      // Both the LDAP server and the replication server believes that the
+      // window is closed. Lets check the flowcontrol in case we
+      // can now resume operations and send a windowMessage if necessary.
+      checkWindow();
+    }
+  }
 }

--
Gitblit v1.10.0