diff --git a/src/core/dht_manager.cc b/src/core/dht_manager.cc index 611ec72c..d9f3d336 100644 --- a/src/core/dht_manager.cc +++ b/src/core/dht_manager.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -62,7 +63,14 @@ DhtManager::load_dht_cache() { LT_LOG("could not open cache file (path:%s)", cache_filename.c_str()); } - torrent::runtime::network_manager()->dht_controller()->initialize(cache); + try { + torrent::runtime::network_manager()->dht_controller()->initialize(cache); + + } catch (const torrent::base_error& e) { + LT_LOG_ERROR("cache file rejected, discarding (path:%s errmsg:%s)", cache_filename.c_str(), e.what()); + + torrent::runtime::network_manager()->dht_controller()->initialize(torrent::Object::create_map()); + } if (m_start == dht_on) start_dht();