From 12ebfa0c820f925e56338d373fe084b91633b72e Mon Sep 17 00:00:00 2001 From: James Moore Date: Sun, 12 Aug 2018 09:11:39 -0700 Subject: [PATCH] net_plugin::plugin_startup gives more information when it attempts to bind to a port Helps people diagnose problems with issues like #3999. --- plugins/net_plugin/net_plugin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 5363f035210..5aa6883e537 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -3008,7 +3008,13 @@ namespace eosio { if( my->acceptor ) { my->acceptor->open(my->listen_endpoint.protocol()); my->acceptor->set_option(tcp::acceptor::reuse_address(true)); - my->acceptor->bind(my->listen_endpoint); + try { + my->acceptor->bind(my->listen_endpoint); + } catch (const std::exception& e) { + ilog("net_plugin::plugin_startup failed to bind to port ${port}", + ("port", my->listen_endpoint.port())); + throw e; + } my->acceptor->listen(); ilog("starting listener, max clients is ${mc}",("mc",my->max_client_count)); my->start_listen_loop();