diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-23 08:44:20 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-23 08:44:31 +0100 |
commit | 8b2cf12b538fdf062b79c03f76626b541bfb66b7 (patch) | |
tree | 7633d39d066303f966211aa2384460f1e759d4e8 /src/rpcserver.cpp | |
parent | 6746787a0cd2eb3fcc7426f7f5275783228e7a45 (diff) | |
parent | a8db31c83d6a43e07f741f7f61b1bf0df87621c7 (diff) |
Merge pull request #3553
a8db31c qt: allow `walletpassphrase` in debug console without -server (Wladimir J. van der Laan)
Diffstat (limited to 'src/rpcserver.cpp')
-rw-r--r-- | src/rpcserver.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 9d34a900ff..0d9e95402b 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -38,6 +38,7 @@ static asio::io_service* rpc_io_service = NULL; static map<string, boost::shared_ptr<deadline_timer> > deadlineTimers; static ssl::context* rpc_ssl_context = NULL; static boost::thread_group* rpc_worker_group = NULL; +static boost::asio::io_service::work *rpc_dummy_work = NULL; void RPCTypeCheck(const Array& params, const list<Value_type>& typesExpected, @@ -607,6 +608,19 @@ void StartRPCThreads() rpc_worker_group->create_thread(boost::bind(&asio::io_service::run, rpc_io_service)); } +void StartDummyRPCThread() +{ + if(rpc_io_service == NULL) + { + rpc_io_service = new asio::io_service(); + /* Create dummy "work" to keep the thread from exiting when no timeouts active, + * see http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work */ + rpc_dummy_work = new asio::io_service::work(*rpc_io_service); + rpc_worker_group = new boost::thread_group(); + rpc_worker_group->create_thread(boost::bind(&asio::io_service::run, rpc_io_service)); + } +} + void StopRPCThreads() { if (rpc_io_service == NULL) return; @@ -615,6 +629,7 @@ void StopRPCThreads() rpc_io_service->stop(); if (rpc_worker_group != NULL) rpc_worker_group->join_all(); + delete rpc_dummy_work; rpc_dummy_work = NULL; delete rpc_worker_group; rpc_worker_group = NULL; delete rpc_ssl_context; rpc_ssl_context = NULL; delete rpc_io_service; rpc_io_service = NULL; |