aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiel van Schijndel <me@mortis.eu>2012-05-20 20:27:53 +0200
committerGiel van Schijndel <me@mortis.eu>2012-05-25 07:27:25 +0200
commitfbf9df2ea32528c71b58160283b4eb2c52e30ccb (patch)
treedef12ac38eb690aa16784a7e3f344917a139253c /src
parent7cc2ceae09d7b36f9054e8f57c1fa7ba87e21171 (diff)
Use the QueueShutdown signal to stop accepting new RPC connections
Signed-off-by: Giel van Schijndel <me@mortis.eu>
Diffstat (limited to 'src')
-rw-r--r--src/bitcoinrpc.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index bd7cb3ef44..9e785a3e37 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -2798,6 +2798,12 @@ void ThreadRPCServer2(void* parg)
const bool fUseSSL = GetBoolArg("-rpcssl");
asio::io_service io_service;
+
+ // Make sure that we'll get stopped when the application shuts down
+ boost::signals2::scoped_connection rpc_listen_thread_stop(
+ uiInterface.QueueShutdown.connect(boost::bind(
+ &asio::io_service::stop, &io_service)));
+
ssl::context context(io_service, ssl::context::sslv23);
if (fUseSSL)
{
@@ -2862,8 +2868,7 @@ void ThreadRPCServer2(void* parg)
}
vnThreadsRunning[THREAD_RPCLISTENER]--;
- while (!fShutdown)
- io_service.run_one();
+ io_service.run();
vnThreadsRunning[THREAD_RPCLISTENER]++;
// Terminate all outstanding accept-requests
@@ -2873,11 +2878,6 @@ void ThreadRPCServer2(void* parg)
acceptor->close();
}
acceptors.clear();
-
- // Handle any actions that are still in progress.
- vnThreadsRunning[THREAD_RPCLISTENER]--;
- io_service.run();
- vnThreadsRunning[THREAD_RPCLISTENER]++;
}
void ThreadRPCServer3(void* parg)