Merge pull request #522

34e3889 p2p: failure to load p2pstate.bin is not fatal anymore (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2015-12-08 20:10:01 +02:00
commit e7872656bc
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -133,9 +133,18 @@ namespace nodetool
std::ifstream p2p_data; std::ifstream p2p_data;
p2p_data.open( state_file_path , std::ios_base::binary | std::ios_base::in); p2p_data.open( state_file_path , std::ios_base::binary | std::ios_base::in);
if(!p2p_data.fail()) if(!p2p_data.fail())
{
try
{ {
boost::archive::binary_iarchive a(p2p_data); boost::archive::binary_iarchive a(p2p_data);
a >> *this; 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 }else
{ {
make_default_config(); make_default_config();