From 278c6c9f3e68e5edcb5b155199e40337225a458a Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 7 Oct 2007 03:41:56 +0000 Subject: [PATCH] fixes files that were left open in write mode by mistake, policy invariant check fix, fixed static assert being hit --- libtorrent/src/policy.cpp | 1 + libtorrent/src/storage.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libtorrent/src/policy.cpp b/libtorrent/src/policy.cpp index 5c69ea3bd..dff860bd2 100755 --- a/libtorrent/src/policy.cpp +++ b/libtorrent/src/policy.cpp @@ -1470,6 +1470,7 @@ namespace libtorrent { policy::peer* p = static_cast(*i); if (p == 0) continue; + if (p->connection == 0) continue; TORRENT_ASSERT(std::find_if(m_peers.begin(), m_peers.end() , match_peer_connection(*p->connection)) != m_peers.end()); } diff --git a/libtorrent/src/storage.cpp b/libtorrent/src/storage.cpp index f855dce8b..1cac99e44 100755 --- a/libtorrent/src/storage.cpp +++ b/libtorrent/src/storage.cpp @@ -460,6 +460,8 @@ namespace libtorrent ->set_size(file_iter->size); } } + // close files that were opened in write mode + m_files.release(this); } void storage::release_files()