aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-09-21 17:16:00 +0200
committerWladimir J. van der Laan <[email protected]>2015-09-21 17:16:40 +0200
commit5e21388c4812e73a15f0e50a9186d154bece27a8 (patch)
tree46da064f42fe524c21533984e0827a60550765e0 /src/bitcoin-cli.cpp
parentMerge pull request #6654 (diff)
parentMake RPC tests cope with server-side timeout between requests (diff)
downloaddiscoin-5e21388c4812e73a15f0e50a9186d154bece27a8.tar.xz
discoin-5e21388c4812e73a15f0e50a9186d154bece27a8.zip
Merge pull request #6695
ddf98d1 Make RPC tests cope with server-side timeout between requests (Wladimir J. van der Laan) 2190ea6 rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout (Wladimir J. van der Laan) 8b2d6ed http: Disable libevent debug logging, if not explicitly enabled (Wladimir J. van der Laan) 5ce43da init: Ignore SIGPIPE (Wladimir J. van der Laan)
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 866c6f2d4..7839b3b6b 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -22,6 +22,8 @@
using namespace std;
+static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
+
std::string HelpMessageCli()
{
string strUsage;
@@ -37,6 +39,7 @@ std::string HelpMessageCli()
strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start"));
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
+ strUsage += HelpMessageOpt("-rpcclienttimeout=<n>", strprintf(_("Timeout during HTTP requests (default: %d)"), DEFAULT_HTTP_CLIENT_TIMEOUT));
return strUsage;
}
@@ -150,7 +153,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
struct evhttp_connection *evcon = evhttp_connection_base_new(base, NULL, host.c_str(), port); // TODO RAII
if (evcon == NULL)
throw runtime_error("create connection failed");
- evhttp_connection_set_timeout(evcon, GetArg("-rpctimeout", 30));
+ evhttp_connection_set_timeout(evcon, GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT));
HTTPReply response;
struct evhttp_request *req = evhttp_request_new(http_request_done, (void*)&response); // TODO RAII