diff --git a/configure.ac b/configure.ac index b8f95fef..c21d183d 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ AC_LANG_POP(C++) AC_DEFINE(HAVE_CONFIG_H, 1, true if config.h was included) AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version()], Http user agent) -AC_CHECK_FUNC(posix_memalign) +AC_CHECK_FUNCS(posix_memalign) TORRENT_CHECK_CACHELINE() CC_ATTRIBUTE_UNUSED( diff --git a/src/core/dht_manager.cc b/src/core/dht_manager.cc index 5f68f566..6a127545 100644 --- a/src/core/dht_manager.cc +++ b/src/core/dht_manager.cc @@ -73,8 +73,12 @@ DhtManager::load_dht_cache() { if (cache_file.is_open()) { cache_file >> cache; - if (cache_file.fail()) - throw torrent::input_error("Invalid DHT cache."); + // If the cache file is corrupted we will just discard it with an + // error message. + if (cache_file.fail()) { + control->core()->push_log("DHT warning: Cache file corrupted, discarding."); + cache = torrent::Object::create_map(); + } } try {