Browse Source

rpcserver: attempt to fix uncaught exception.

0.13
Cory Fields 10 years ago
parent
commit
8db1760751
  1. 10
      src/rpcserver.cpp

10
src/rpcserver.cpp

@ -650,14 +650,16 @@ void StartRPCThreads()
bool fListening = false; bool fListening = false;
std::string strerr; std::string strerr;
std::string straddress;
BOOST_FOREACH(const ip::tcp::endpoint &endpoint, vEndpoints) BOOST_FOREACH(const ip::tcp::endpoint &endpoint, vEndpoints)
{ {
try {
asio::ip::address bindAddress = endpoint.address(); asio::ip::address bindAddress = endpoint.address();
LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", bindAddress.to_string(), endpoint.port(), bBindAny); straddress = bindAddress.to_string();
LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", straddress, 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));
try {
acceptor->open(endpoint.protocol()); acceptor->open(endpoint.protocol());
acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
@ -678,8 +680,8 @@ void StartRPCThreads()
} }
catch (const boost::system::system_error& e) catch (const boost::system::system_error& e)
{ {
LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", bindAddress.to_string(), endpoint.port(), e.what()); LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", straddress, endpoint.port(), e.what());
strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), bindAddress.to_string(), endpoint.port(), e.what()); strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), straddress, endpoint.port(), e.what());
} }
} }

Loading…
Cancel
Save