From f24118fad27564bc163fd5c4a2955ca36c73489c Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 12 Oct 2006 15:08:00 +0000
Subject: [PATCH] Update the server code to eliminate the need for a 5-second delay when attempting to terminate a client connection from within an operation plugin. The issue arose when the attempt to terminate the connection tried to cancel the operation that initiated the disconnect, which made it necessary to wait for a 5-second timeout before continuing.

---
 opends/src/server/org/opends/server/core/ExtendedOperation.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/ExtendedOperation.java b/opends/src/server/org/opends/server/core/ExtendedOperation.java
index b641e8e..458ceb9 100644
--- a/opends/src/server/org/opends/server/core/ExtendedOperation.java
+++ b/opends/src/server/org/opends/server/core/ExtendedOperation.java
@@ -41,6 +41,7 @@
 import org.opends.server.types.CancelRequest;
 import org.opends.server.types.CancelResult;
 import org.opends.server.types.Control;
+import org.opends.server.types.DisconnectReason;
 import org.opends.server.types.DN;
 import org.opends.server.types.OperationType;
 import org.opends.server.types.ResultCode;
@@ -327,6 +328,25 @@
    * {@inheritDoc}
    */
   @Override()
+  public final void disconnectClient(DisconnectReason disconnectReason,
+                                     boolean sendNotification, String message,
+                                     int messageID)
+  {
+    // Before calling clientConnection.disconnect, we need to mark this
+    // operation as cancelled so that the attempt to cancel it later won't cause
+    // an unnecessary delay.
+    setCancelResult(CancelResult.CANCELED);
+
+    clientConnection.disconnect(disconnectReason, sendNotification, message,
+                                messageID);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override()
   public final String[][] getRequestLogElements()
   {
     // Note that no debugging will be done in this method because it is a likely

--
Gitblit v1.10.0