diff --git a/libtorrent/include/libtorrent/storage.hpp b/libtorrent/include/libtorrent/storage.hpp index a3f97b589..a7b5e37a4 100755 --- a/libtorrent/include/libtorrent/storage.hpp +++ b/libtorrent/include/libtorrent/storage.hpp @@ -376,6 +376,9 @@ namespace libtorrent // the piece_manager destructs. This is because // the torrent_info object is owned by the torrent. boost::shared_ptr m_torrent; +#ifndef NDEBUG + bool m_resume_data_verified; +#endif }; } diff --git a/libtorrent/src/enum_net.cpp b/libtorrent/src/enum_net.cpp index 3eb8df837..5431b7c53 100644 --- a/libtorrent/src/enum_net.cpp +++ b/libtorrent/src/enum_net.cpp @@ -45,6 +45,8 @@ POSSIBILITY OF SUCH DAMAGE. #endif #include "libtorrent/enum_net.hpp" +// for is_loopback and is_any +#include "libtorrent/broadcast_socket.hpp" namespace libtorrent { diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index a78507af0..80e7ee7bc 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -1855,7 +1855,6 @@ namespace detail { tracker_request req = t.generate_tracker_request(); TORRENT_ASSERT(req.event == tracker_request::stopped); - TORRENT_ASSERT(!m_listen_sockets.empty()); req.listen_port = 0; if (!m_listen_sockets.empty()) req.listen_port = m_listen_sockets.front().external_port; diff --git a/libtorrent/src/storage.cpp b/libtorrent/src/storage.cpp index 810626f52..69701f734 100755 --- a/libtorrent/src/storage.cpp +++ b/libtorrent/src/storage.cpp @@ -581,8 +581,9 @@ namespace libtorrent // the resume data says we have the entire torrent // make sure the file sizes are the right ones for (torrent_info::file_iterator i = m_info->begin_files(true) - , end(m_info->end_files(true)); i != end; ++i, ++fs) + , end(m_info->end_files(true)); i != end; ++i, ++fs) { + std::cerr << "filesize: " << i->size << std::endl; if (i->size != fs->first) { error = "file size for '" + i->path.native_file_string() @@ -591,7 +592,6 @@ namespace libtorrent return false; } } - return true; } return match_filesizes(*m_info, m_save_path, file_sizes @@ -998,6 +998,9 @@ namespace libtorrent , m_io_thread(io) , m_torrent(torrent) { +#ifndef NDEBUG + m_resume_data_verified = false; +#endif } piece_manager::~piece_manager() @@ -1011,6 +1014,9 @@ namespace libtorrent bool piece_manager::verify_resume_data(entry& rd, std::string& error) { +#ifndef NDEBUG + m_resume_data_verified = true; +#endif return m_storage->verify_resume_data(rd, error); } @@ -1473,6 +1479,7 @@ namespace libtorrent if (!data.piece_map.empty() && int(data.piece_map.size()) <= m_info->num_pieces()) { + TORRENT_ASSERT(m_resume_data_verified); for (int i = 0; i < (int)data.piece_map.size(); ++i) { m_slot_to_piece[i] = data.piece_map[i];