aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-07 00:20:00 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-07 00:20:56 +0000
commit34e388949d36c78b3c6d12c18f00cc058f462867 (patch)
treea235da22db306a12a73869cc54c66e586ddd51a2
parentMerge pull request #518 (diff)
downloadmonero-34e388949d36c78b3c6d12c18f00cc058f462867.tar.xz
p2p: failure to load p2pstate.bin is not fatal anymore
Clear any partially loaded data, and start with a default config
-rw-r--r--src/p2p/net_node.inl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 067f6378d..6bbad0258 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -134,8 +134,17 @@ namespace nodetool
p2p_data.open( state_file_path , std::ios_base::binary | std::ios_base::in);
if(!p2p_data.fail())
{
- boost::archive::binary_iarchive a(p2p_data);
- a >> *this;
+ 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();