aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-12-30 17:34:22 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-12-30 17:36:30 +0100
commitf9c571aad8261eb9a5cab9dce5b490bd253c5fe1 (patch)
tree9c17e2ca7d4730b4b8ab3ee2bb26504053b8c6e0
parenta99ef7d3533b5685bd871365b4574aa4d8e0ca20 (diff)
parent8db17607510eb250f3faf7963affa337eb7039d5 (diff)
Merge pull request #5565
8db1760 rpcserver: attempt to fix uncaught exception. (Cory Fields)
-rw-r--r--src/rpcserver.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index c5d74afba9..210c7fe973 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -650,14 +650,16 @@ void StartRPCThreads()
bool fListening = false;
std::string strerr;
+ std::string straddress;
BOOST_FOREACH(const ip::tcp::endpoint &endpoint, vEndpoints)
{
- 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);
- boost::system::error_code v6_only_error;
- boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service));
-
try {
+ asio::ip::address bindAddress = endpoint.address();
+ 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::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service));
+
acceptor->open(endpoint.protocol());
acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
@@ -678,8 +680,8 @@ void StartRPCThreads()
}
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());
- strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), 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"), straddress, endpoint.port(), e.what());
}
}