From 35a408038c1de64a6f13f0e7b246a645e9945e3c Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 18 Mar 2008 22:44:58 +0000
Subject: [PATCH] With this refactoring:

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 6ed56e6..6091c41 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -975,8 +975,11 @@
     // Indicate that this connection is no longer valid.
     connectionValid = false;
 
-
-    cancelAllOperations(new CancelRequest(true, message));
+    MessageBuilder msgBuilder = new MessageBuilder();
+    msgBuilder.append(disconnectReason.getClosureMessage());
+    msgBuilder.append(": ");
+    msgBuilder.append(message);
+    cancelAllOperations(new CancelRequest(true, msgBuilder.toMessage()));
     finalizeConnectionInternal();
 
 
@@ -1271,7 +1274,8 @@
           CancelResult cancelResult =
                ps.getSearchOperation().cancel(cancelRequest);
 
-          if (keepStats && (cancelResult == CancelResult.CANCELED))
+          if (keepStats && (cancelResult.getResultCode() ==
+              ResultCode.CANCELED))
           {
             statTracker.updateAbandonedOperation();
           }
@@ -1280,12 +1284,12 @@
         }
       }
 
-      return CancelResult.NO_SUCH_OPERATION;
+      return new CancelResult(ResultCode.NO_SUCH_OPERATION, null);
     }
     else
     {
       CancelResult cancelResult = op.cancel(cancelRequest);
-      if (keepStats && (cancelResult == CancelResult.CANCELED))
+      if (keepStats && (cancelResult.getResultCode() == ResultCode.CANCELED))
       {
         statTracker.updateAbandonedOperation();
       }
@@ -1313,16 +1317,10 @@
         {
           try
           {
-            CancelResult cancelResult = o.getCancelResult();
-            if (cancelResult == null) {
-              // Before calling cancelling the operation, we need to
-              // mark this operation as cancelled so that the attempt to
-              // cancel it later won't cause an unnecessary delay.
-              o.setCancelResult(CancelResult.CANCELED);
-              cancelResult = o.cancel(cancelRequest);
-            }
+              o.abort(cancelRequest);
 
-            if (keepStats && (cancelResult == CancelResult.CANCELED))
+            // TODO: Assume its cancelled?
+            if (keepStats)
             {
               statTracker.updateAbandonedOperation();
             }
@@ -1391,8 +1389,10 @@
           {
             try
             {
-              CancelResult cancelResult = o.cancel(cancelRequest);
-              if (keepStats && (cancelResult == CancelResult.CANCELED))
+              o.abort(cancelRequest);
+
+              // TODO: Assume its cancelled?
+              if (keepStats)
               {
                 statTracker.updateAbandonedOperation();
               }

--
Gitblit v1.10.0