From eb152f66224f9d6324640059a4d1114f7efa7fe1 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 02 Oct 2009 06:47:04 +0000
Subject: [PATCH] Fix for 4265 : Unit test AssuredReplicationServerTest#testSafeDataLevelOne suffers randoms failures

---
 opends/src/server/org/opends/server/replication/server/MessageHandler.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/MessageHandler.java b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
index 1ad9574..b53ba96 100644
--- a/opends/src/server/org/opends/server/replication/server/MessageHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -403,9 +403,11 @@
             iterator.releaseCursor();
           }
           /*
-           * Check if the first change in the lateQueue is also on the regular
-           * queue
+           * If the late queue is empty then we could not find any
+           * messages in the replication log so the remote serevr is not
+           * late anymore.
            */
+
           if (lateQueue.isEmpty())
           {
             synchronized (msgQueue)
@@ -418,6 +420,11 @@
             }
           } else
           {
+            /*
+             * if the first change in the lateQueue is also on the regular
+             * queue, we can resume the processing from the regular queue
+             * -> set following to true and empty the lateQueue.
+             */
             msg = lateQueue.first();
             synchronized (msgQueue)
             {
@@ -432,7 +439,7 @@
                   msg1 = msgQueue.removeFirst();
                 } while (!msg.getChangeNumber().equals(msg1.getChangeNumber()));
                 this.updateServerState(msg);
-                return msg;
+                return msg1;
               }
             }
           }

--
Gitblit v1.10.0