From 03fe0954e42abf00746b8efa4c79ee74cf514427 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 15:10:50 +0000
Subject: [PATCH] Fix an issue with connection timeouts in CLI. The timeout is now configurable on CLI with the --connectTimeout option (expressed in milliseconds), the default is 30 000 milliseconds. This solves Issue 4196.

---
 opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java b/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
index f3e68a9..60f3a0c 100644
--- a/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
+++ b/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -57,6 +57,7 @@
 
 import org.opends.admin.ads.util.ApplicationKeyManager;
 import org.opends.admin.ads.util.ApplicationTrustManager;
+import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.quicksetup.Constants;
 import org.opends.server.admin.AdministrationConnector;
 import org.opends.server.admin.server.ServerManagementContext;
@@ -172,6 +173,11 @@
   public StringArgument  saslOptionArg = null;
 
   /**
+   * Argument to specify the connection timeout.
+   */
+  public IntegerArgument connectTimeoutArg = null;
+
+  /**
    * Private container for global arguments.
    */
   private LinkedHashSet<Argument> argList = null;
@@ -483,6 +489,7 @@
     portArg = new IntegerArgument("port", OPTION_SHORT_PORT, OPTION_LONG_PORT,
         false, false, true, INFO_PORT_PLACEHOLDER.get(),
         AdministrationConnector.DEFAULT_ADMINISTRATION_CONNECTOR_PORT, null,
+        true, 1, true, 65535,
         portDescription);
     portArg.setPropertyName(OPTION_LONG_PORT);
     argList.add(portArg);
@@ -581,6 +588,16 @@
     certNicknameArg.setPropertyName(OPTION_LONG_CERT_NICKNAME);
     argList.add(certNicknameArg);
 
+    int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout();
+    connectTimeoutArg = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT,
+        null, OPTION_LONG_CONNECT_TIMEOUT,
+        false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(),
+        defaultTimeout, null,
+        true, 0, false, Integer.MAX_VALUE,
+        INFO_DESCRIPTION_CONNECTION_TIMEOUT.get());
+    connectTimeoutArg.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT);
+    argList.add(connectTimeoutArg);
+
     return argList;
   }
 

--
Gitblit v1.10.0