mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 23:38:06 +00:00
Use the QueueShutdown signal to stop accepting new RPC connections
Signed-off-by: Giel van Schijndel <me@mortis.eu>
This commit is contained in:
parent
7cc2ceae09
commit
fbf9df2ea3
@ -2798,6 +2798,12 @@ void ThreadRPCServer2(void* parg)
|
|||||||
const bool fUseSSL = GetBoolArg("-rpcssl");
|
const bool fUseSSL = GetBoolArg("-rpcssl");
|
||||||
|
|
||||||
asio::io_service io_service;
|
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);
|
ssl::context context(io_service, ssl::context::sslv23);
|
||||||
if (fUseSSL)
|
if (fUseSSL)
|
||||||
{
|
{
|
||||||
@ -2862,8 +2868,7 @@ void ThreadRPCServer2(void* parg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vnThreadsRunning[THREAD_RPCLISTENER]--;
|
vnThreadsRunning[THREAD_RPCLISTENER]--;
|
||||||
while (!fShutdown)
|
io_service.run();
|
||||||
io_service.run_one();
|
|
||||||
vnThreadsRunning[THREAD_RPCLISTENER]++;
|
vnThreadsRunning[THREAD_RPCLISTENER]++;
|
||||||
|
|
||||||
// Terminate all outstanding accept-requests
|
// Terminate all outstanding accept-requests
|
||||||
@ -2873,11 +2878,6 @@ void ThreadRPCServer2(void* parg)
|
|||||||
acceptor->close();
|
acceptor->close();
|
||||||
}
|
}
|
||||||
acceptors.clear();
|
acceptors.clear();
|
||||||
|
|
||||||
// Handle any actions that are still in progress.
|
|
||||||
vnThreadsRunning[THREAD_RPCLISTENER]--;
|
|
||||||
io_service.run();
|
|
||||||
vnThreadsRunning[THREAD_RPCLISTENER]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadRPCServer3(void* parg)
|
void ThreadRPCServer3(void* parg)
|
||||||
|
Loading…
Reference in New Issue
Block a user