Merge pull request #18 from abitmore/bts2-bts-fix-dns-exception-rework
Catch DNS exceptions when adding seed nodes
This commit is contained in:
commit
252e34a3e1
1 changed files with 31 additions and 16 deletions
|
|
@ -125,12 +125,17 @@ namespace detail {
|
||||||
auto seeds = _options->at("seed-node").as<vector<string>>();
|
auto seeds = _options->at("seed-node").as<vector<string>>();
|
||||||
for( const string& endpoint_string : seeds )
|
for( const string& endpoint_string : seeds )
|
||||||
{
|
{
|
||||||
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
try {
|
||||||
for (const fc::ip::endpoint& endpoint : endpoints)
|
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
||||||
{
|
for (const fc::ip::endpoint& endpoint : endpoints)
|
||||||
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
{
|
||||||
_p2p_network->add_node(endpoint);
|
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
||||||
_p2p_network->connect_to_endpoint(endpoint);
|
_p2p_network->add_node(endpoint);
|
||||||
|
_p2p_network->connect_to_endpoint(endpoint);
|
||||||
|
}
|
||||||
|
} catch( const fc::exception& e ) {
|
||||||
|
wlog( "caught exception ${e} while adding seed node ${endpoint}",
|
||||||
|
("e", e.to_detail_string())("endpoint", endpoint_string) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,11 +146,16 @@ namespace detail {
|
||||||
auto seeds = fc::json::from_string(seeds_str).as<vector<string>>();
|
auto seeds = fc::json::from_string(seeds_str).as<vector<string>>();
|
||||||
for( const string& endpoint_string : seeds )
|
for( const string& endpoint_string : seeds )
|
||||||
{
|
{
|
||||||
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
try {
|
||||||
for (const fc::ip::endpoint& endpoint : endpoints)
|
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
||||||
{
|
for (const fc::ip::endpoint& endpoint : endpoints)
|
||||||
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
{
|
||||||
_p2p_network->add_node(endpoint);
|
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
||||||
|
_p2p_network->add_node(endpoint);
|
||||||
|
}
|
||||||
|
} catch( const fc::exception& e ) {
|
||||||
|
wlog( "caught exception ${e} while adding seed node ${endpoint}",
|
||||||
|
("e", e.to_detail_string())("endpoint", endpoint_string) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -172,11 +182,16 @@ namespace detail {
|
||||||
};
|
};
|
||||||
for( const string& endpoint_string : seeds )
|
for( const string& endpoint_string : seeds )
|
||||||
{
|
{
|
||||||
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
try {
|
||||||
for (const fc::ip::endpoint& endpoint : endpoints)
|
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(endpoint_string);
|
||||||
{
|
for (const fc::ip::endpoint& endpoint : endpoints)
|
||||||
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
{
|
||||||
_p2p_network->add_node(endpoint);
|
ilog("Adding seed node ${endpoint}", ("endpoint", endpoint));
|
||||||
|
_p2p_network->add_node(endpoint);
|
||||||
|
}
|
||||||
|
} catch( const fc::exception& e ) {
|
||||||
|
wlog( "caught exception ${e} while adding seed node ${endpoint}",
|
||||||
|
("e", e.to_detail_string())("endpoint", endpoint_string) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue