Browse Source

Add config option 'rpcasyncthreads' to specify number of async rpc workers. Default is 1.

pull/4/head
Simon 8 years ago
parent
commit
8d08172d0d
  1. 1
      src/init.cpp
  2. 13
      src/rpcserver.cpp

1
src/init.cpp

@ -424,6 +424,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> 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=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), 4));
strUsage += HelpMessageOpt("-rpckeepalive", strprintf(_("RPC support for HTTP persistent connections (default: %d)"), 1));
strUsage += HelpMessageOpt("-rpcasyncthreads=<n>", strprintf(_("Set the number of threads to service Async RPC calls (default: %d)"), 1));
strUsage += HelpMessageGroup(_("RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)"));
strUsage += HelpMessageOpt("-rpcssl", _("Use OpenSSL (https) for JSON-RPC connections"));

13
src/rpcserver.cpp

@ -746,9 +746,16 @@ void StartRPCThreads()
// Launch at least one async rpc worker
async_rpc_queue = std::make_shared<AsyncRPCQueue>();
async_rpc_queue->addWorker();
async_rpc_queue->addWorker();
async_rpc_queue->addWorker();
int n = GetArg("-rpcasyncthreads", 1);
if (n<1) {
LogPrintf("ERROR: Invalid value %d for -rpcasyncthreads. Must be at least 1.\n", n);
strerr = strprintf(_("An error occurred while setting up the Async RPC threads, invalid parameter value of %d (must be at least 1)."), n);
uiInterface.ThreadSafeMessageBox(strerr, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return;
}
for (int i = 0; i < n; i++)
async_rpc_queue->addWorker();
}

Loading…
Cancel
Save