From 065c1ae206bec7f9dcdd394f5fe06ab8e4005655 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 07 Jun 2010 09:12:48 +0000
Subject: [PATCH] Fix issue #2748. This patch changes the place where messages are logged to ensure correct ordering: - Request handler now logs the connect messages before registering the read interest. - Worker threads logs the response messages before sending it to the client.

---
 opends/src/server/org/opends/server/core/SearchOperationBasis.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SearchOperationBasis.java b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
index d1d2ba1..715c3fb 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.core;
 
@@ -811,11 +811,12 @@
     // Send the entry to the client.
     if (pluginResult.sendResponse())
     {
+      // Log the entry sent to the client.
+      logSearchResultEntry(this, searchEntry);
+
       try
       {
         sendSearchEntry(searchEntry);
-        // Log the entry sent to the client.
-        logSearchResultEntry(this, searchEntry);
 
         incrementEntriesSent();
       }
@@ -889,12 +890,13 @@
     // to send any more.
     if (pluginResult.sendResponse())
     {
+      // Log the entry sent to the client.
+      logSearchResultReference(this, reference);
+
       try
       {
         if (sendSearchReference(reference))
         {
-          // Log the entry sent to the client.
-          logSearchResultReference(this, reference);
           incrementReferencesSent();
 
           // FIXME -- Should the size limit apply here?
@@ -931,12 +933,11 @@
     // multithreaded in the event of a persistent search, so do it safely.
     if (responseSent.compareAndSet(false, true))
     {
-      // Send the response to the client.
-      clientConnection.sendResponse(this);
-
       // Log the search result.
       logSearchResultDone(this);
 
+      // Send the response to the client.
+      clientConnection.sendResponse(this);
 
       // Invoke the post-response search plugins.
       invokePostResponsePlugins();

--
Gitblit v1.10.0