p2p: failure to load p2pstate.bin is not fatal anymore

Clear any partially loaded data, and start with a default config
This commit is contained in:
moneromooo-monero 2015-12-07 00:20:00 +00:00
parent 0252ffc37b
commit 34e388949d
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -133,9 +133,18 @@ namespace nodetool
std::ifstream p2p_data;
p2p_data.open( state_file_path , std::ios_base::binary | std::ios_base::in);
if(!p2p_data.fail())
{
try
{
boost::archive::binary_iarchive a(p2p_data);
a >> *this;
}
catch (const std::exception &e)
{
LOG_ERROR("Failed to load p2p config file, falling back to default config");
m_peerlist = peerlist_manager(); // it was probably half clobbered by the failed load
make_default_config();
}
}else
{
make_default_config();