Use a rpc-specific queue to tell asio connections to shutdown.
This commit is contained in:
parent
18c4beb05b
commit
7cf3d2ccb9
1 changed files with 5 additions and 2 deletions
|
@ -2858,6 +2858,8 @@ void ThreadRPCServer2(void* parg)
|
||||||
asio::ip::address bindAddress = loopback ? asio::ip::address_v6::loopback() : asio::ip::address_v6::any();
|
asio::ip::address bindAddress = loopback ? asio::ip::address_v6::loopback() : asio::ip::address_v6::any();
|
||||||
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332));
|
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332));
|
||||||
|
|
||||||
|
boost::signals2::signal<void ()> StopRequests;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service));
|
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service));
|
||||||
|
@ -2873,7 +2875,7 @@ void ThreadRPCServer2(void* parg)
|
||||||
|
|
||||||
RPCListen(acceptor, context, fUseSSL);
|
RPCListen(acceptor, context, fUseSSL);
|
||||||
// Cancel outstanding listen-requests for this acceptor when shutting down
|
// Cancel outstanding listen-requests for this acceptor when shutting down
|
||||||
uiInterface.QueueShutdown.connect(signals2::slot<void ()>(
|
StopRequests.connect(signals2::slot<void ()>(
|
||||||
static_cast<void (ip::tcp::acceptor::*)()>(&ip::tcp::acceptor::close), acceptor.get())
|
static_cast<void (ip::tcp::acceptor::*)()>(&ip::tcp::acceptor::close), acceptor.get())
|
||||||
.track(acceptor));
|
.track(acceptor));
|
||||||
|
|
||||||
|
@ -2891,7 +2893,7 @@ void ThreadRPCServer2(void* parg)
|
||||||
|
|
||||||
RPCListen(acceptor, context, fUseSSL);
|
RPCListen(acceptor, context, fUseSSL);
|
||||||
// Cancel outstanding listen-requests for this acceptor when shutting down
|
// Cancel outstanding listen-requests for this acceptor when shutting down
|
||||||
uiInterface.QueueShutdown.connect(signals2::slot<void ()>(
|
StopRequests.connect(signals2::slot<void ()>(
|
||||||
static_cast<void (ip::tcp::acceptor::*)()>(&ip::tcp::acceptor::close), acceptor.get())
|
static_cast<void (ip::tcp::acceptor::*)()>(&ip::tcp::acceptor::close), acceptor.get())
|
||||||
.track(acceptor));
|
.track(acceptor));
|
||||||
}
|
}
|
||||||
|
@ -2908,6 +2910,7 @@ void ThreadRPCServer2(void* parg)
|
||||||
while (!fShutdown)
|
while (!fShutdown)
|
||||||
io_service.run_one();
|
io_service.run_one();
|
||||||
vnThreadsRunning[THREAD_RPCLISTENER]++;
|
vnThreadsRunning[THREAD_RPCLISTENER]++;
|
||||||
|
StopRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadRPCServer3(void* parg)
|
void ThreadRPCServer3(void* parg)
|
||||||
|
|
Loading…
Reference in a new issue