From 6d2bc221463ffe3ed3a99e8c682b090983b2e7b5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 28 Aug 2015 17:14:51 +0200 Subject: [PATCH] Document options for new HTTP/RPC server in --help --- src/httpserver.cpp | 6 +++--- src/httpserver.h | 4 ++++ src/init.cpp | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 13f870567..813764f22 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -355,7 +355,7 @@ bool StartHTTPServer(boost::thread_group& threadGroup) return false; } - evhttp_set_timeout(http, GetArg("-rpctimeout", 30)); + evhttp_set_timeout(http, GetArg("-rpctimeout", DEFAULT_HTTP_TIMEOUT)); evhttp_set_max_body_size(http, MAX_SIZE); evhttp_set_gencb(http, http_request_cb, NULL); @@ -367,8 +367,8 @@ bool StartHTTPServer(boost::thread_group& threadGroup) } LogPrint("http", "Starting HTTP server\n"); - int workQueueDepth = std::max((long)GetArg("-rpcworkqueue", 16), 1L); - int rpcThreads = std::max((long)GetArg("-rpcthreads", 4), 1L); + int workQueueDepth = std::max((long)GetArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L); + int rpcThreads = std::max((long)GetArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L); LogPrintf("HTTP: creating work queue of depth %d and %d worker threads\n", workQueueDepth, rpcThreads); workQueue = new WorkQueue(workQueueDepth); diff --git a/src/httpserver.h b/src/httpserver.h index 648e8b6f8..1b0d77ad4 100644 --- a/src/httpserver.h +++ b/src/httpserver.h @@ -11,6 +11,10 @@ #include #include +static const int DEFAULT_HTTP_THREADS=4; +static const int DEFAULT_HTTP_WORKQUEUE=16; +static const int DEFAULT_HTTP_TIMEOUT=30; + struct evhttp_request; struct event_base; class CService; diff --git a/src/init.cpp b/src/init.cpp index 835ed4001..bbf73dc8f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -388,7 +388,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", 1)); strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", 0)); } - string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune"; // Don't translate these and qt below + string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http"; // Don't translate these and qt below if (mode == HMM_BITCOIN_QT) debugCategories += ", qt"; strUsage += HelpMessageOpt("-debug=", strprintf(_("Output debugging information (default: %u, supplying is optional)"), 0) + ". " + @@ -438,7 +438,11 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-rpcpassword=", _("Password for JSON-RPC connections")); strUsage += HelpMessageOpt("-rpcport=", strprintf(_("Listen for JSON-RPC connections on (default: %u or testnet: %u)"), 8332, 18332)); strUsage += HelpMessageOpt("-rpcallowip=", _("Allow JSON-RPC connections from specified source. Valid for are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times")); - strUsage += HelpMessageOpt("-rpcthreads=", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), 4)); + strUsage += HelpMessageOpt("-rpcthreads=", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS)); + if (showDebug) { + strUsage += HelpMessageOpt("-rpcworkqueue=", strprintf("Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE)); + strUsage += HelpMessageOpt("-rpctimeout=", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_TIMEOUT)); + } if (mode == HMM_BITCOIN_QT) {