From f1f0269eb9d44014fb396571bce039503c0b6740 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 9 Dec 2014 16:51:08 +0100 Subject: [PATCH] issue #1159: allow --server.request-timeout and --server.connect-timeout of 0 --- arangosh/ArangoShell/ArangoClient.cpp | 14 +++++++++++--- arangosh/ArangoShell/ArangoClient.h | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arangosh/ArangoShell/ArangoClient.cpp b/arangosh/ArangoShell/ArangoClient.cpp index 0a2b2a03a4..72262f62f3 100644 --- a/arangosh/ArangoShell/ArangoClient.cpp +++ b/arangosh/ArangoShell/ArangoClient.cpp @@ -47,6 +47,8 @@ double const ArangoClient::DEFAULT_CONNECTION_TIMEOUT = 3.0; double const ArangoClient::DEFAULT_REQUEST_TIMEOUT = 300.0; size_t const ArangoClient::DEFAULT_RETRIES = 2; +double const ArangoClient::LONG_TIMEOUT = 86400.0; + namespace { #ifdef _WIN32 bool _newLine () { @@ -459,13 +461,19 @@ void ArangoClient::parse (ProgramOptions& options, if (_serverOptions) { // check connection args - if (_connectTimeout <= 0) { - LOG_FATAL_AND_EXIT("invalid value for --server.connect-timeout, must be positive"); + if (_connectTimeout < 0.0) { + LOG_FATAL_AND_EXIT("invalid value for --server.connect-timeout, must be >= 0"); + } + else if (_connectTimeout == 0.0) { + _connectTimeout = LONG_TIMEOUT; } - if (_requestTimeout <= 0) { + if (_requestTimeout < 0.0) { LOG_FATAL_AND_EXIT("invalid value for --server.request-timeout, must be positive"); } + else if (_requestTimeout == 0.0) { + _requestTimeout = LONG_TIMEOUT; + } // must specify a user name if (_username.size() == 0) { diff --git a/arangosh/ArangoShell/ArangoClient.h b/arangosh/ArangoShell/ArangoClient.h index 7a81411e9c..0fdb6fad42 100644 --- a/arangosh/ArangoShell/ArangoClient.h +++ b/arangosh/ArangoShell/ArangoClient.h @@ -87,6 +87,12 @@ namespace triagens { static double const DEFAULT_CONNECTION_TIMEOUT; +//////////////////////////////////////////////////////////////////////////////// +/// @brief default "long" timeout +//////////////////////////////////////////////////////////////////////////////// + + static double const LONG_TIMEOUT; + //////////////////////////////////////////////////////////////////////////////// /// @brief ignore sequence used for prompt length calculation (starting point) ///