mirror of
https://github.com/monero-project/monero.git
synced 2024-12-24 20:49:37 +00:00
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:
parent
0252ffc37b
commit
34e388949d
1 changed files with 11 additions and 2 deletions
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue