From 0f9ee85fd0b36220ef6a3ee8d2b9f5f6f02b26bd Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 11 Feb 2008 13:42:42 +0000
Subject: [PATCH] 

---
 opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
index a21ce43..2eeedb0 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
@@ -954,17 +954,9 @@
         {
           WindowMessage windowMsg = (WindowMessage) msg;
           sendWindow.release(windowMsg.getNumAck());
-        } else
+        }
+        else
         {
-          if (msg instanceof UpdateMessage)
-          {
-            rcvWindow--;
-            if (rcvWindow < halfRcvWindow)
-            {
-              session.publish(new WindowMessage(halfRcvWindow));
-              rcvWindow += halfRcvWindow;
-            }
-          }
           return msg;
         }
       } catch (SocketTimeoutException e)
@@ -988,6 +980,30 @@
   }
 
   /**
+   * This method allows to do the necessary computing for the window
+   * management after treatment by the worker threads.
+   *
+   * This should be called once the replay thread have done their job
+   * and the window can be open again.
+   */
+  public synchronized void updateWindowAfterReplay()
+  {
+    try
+    {
+      rcvWindow--;
+      if (rcvWindow < halfRcvWindow)
+      {
+        session.publish(new WindowMessage(halfRcvWindow));
+        rcvWindow += halfRcvWindow;
+      }
+    } catch (IOException e)
+    {
+      // Any error on the socket will be handled by the thread calling receive()
+      // just ignore.
+    }
+  }
+
+  /**
    * stop the server.
    */
   public void stop()

--
Gitblit v1.10.0