aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-06-19 08:19:07 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-06-19 08:19:52 +0200
commit6afa49329de860c080cdfd9b1c65afe313a43860 (patch)
treeca5f04bc2583e8fc37a4b784bc67dc0909c29122
parent33e5b4291036bbdad075f4a549491af72d8a0618 (diff)
rpc: Add acceptors only when listening succeeded
-rw-r--r--src/rpcserver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index 2f7f5cc2ad..56b5f2de0b 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -642,7 +642,6 @@ void StartRPCThreads()
LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", bindAddress.to_string(), endpoint.port(), bBindAny);
boost::system::error_code v6_only_error;
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service));
- rpc_acceptors.push_back(acceptor);
try {
acceptor->open(endpoint.protocol());
@@ -658,6 +657,7 @@ void StartRPCThreads()
RPCListen(acceptor, *rpc_ssl_context, fUseSSL);
fListening = true;
+ rpc_acceptors.push_back(acceptor);
// If dual IPv6/IPv4 bind succesful, skip binding to IPv4 separately
if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error)
break;