Browse Source

rpc: Add acceptors only when listening succeeded

0.10
Wladimir J. van der Laan 11 years ago
parent
commit
6afa49329d
  1. 2
      src/rpcserver.cpp

2
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); 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::system::error_code v6_only_error;
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service)); boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service));
rpc_acceptors.push_back(acceptor);
try { try {
acceptor->open(endpoint.protocol()); acceptor->open(endpoint.protocol());
@ -658,6 +657,7 @@ void StartRPCThreads()
RPCListen(acceptor, *rpc_ssl_context, fUseSSL); RPCListen(acceptor, *rpc_ssl_context, fUseSSL);
fListening = true; fListening = true;
rpc_acceptors.push_back(acceptor);
// If dual IPv6/IPv4 bind succesful, skip binding to IPv4 separately // If dual IPv6/IPv4 bind succesful, skip binding to IPv4 separately
if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error) if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error)
break; break;

Loading…
Cancel
Save