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/tools/LDAPSearch.java | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPSearch.java b/opends/src/server/org/opends/server/tools/LDAPSearch.java
index 13b131a..7b8dcdd 100644
--- a/opends/src/server/org/opends/server/tools/LDAPSearch.java
+++ b/opends/src/server/org/opends/server/tools/LDAPSearch.java
@@ -22,9 +22,10 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.tools;
+import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.messages.Message;
import java.io.BufferedReader;
@@ -707,6 +708,7 @@
StringArgument sortOrder = null;
StringArgument trustStorePath = null;
StringArgument trustStorePassword = null;
+ IntegerArgument connectTimeout = null;
StringArgument vlvDescriptor = null;
StringArgument effectiveRightsUser = null;
StringArgument effectiveRightsAttrs = null;
@@ -1017,6 +1019,16 @@
version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
argParser.addArgument(version);
+ int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout();
+ connectTimeout = 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());
+ connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT);
+ argParser.addArgument(connectTimeout);
+
encodingStr = new StringArgument("encoding", 'i', "encoding", false,
false, true,
INFO_ENCODING_PLACEHOLDER.get(), null,
@@ -1756,7 +1768,10 @@
AtomicInteger nextMessageID = new AtomicInteger(1);
connection = new LDAPConnection(hostNameValue, portNumber,
connectionOptions, out, err);
- connection.connectToHost(bindDNValue, bindPasswordValue, nextMessageID);
+ int timeout = connectTimeout.getIntValue();
+ connection.connectToHost(bindDNValue, bindPasswordValue, nextMessageID,
+ timeout);
+
int matchingEntries = 0;
if (simplePageSize.isPresent())
--
Gitblit v1.10.0