From eecbb8a0f2f41ff520ef2f4e0d9599afdf84960b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 10 Feb 2012 16:37:50 +0000 Subject: [PATCH] more metadata invariant fixes for edge cases --- src/torrent.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index ebefdf866..0872d3e43 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -5579,6 +5579,14 @@ namespace libtorrent // any of the peers. m_override_resume_data = true; + // disconnect redundant peers + for (std::set::iterator i = m_connections.begin() + , end(m_connections.end()); i != end;) + { + std::set::iterator p = i++; + (*p)->disconnect_if_redundant(); + } + init(); return true; @@ -6844,7 +6852,10 @@ namespace libtorrent TORRENT_ASSERT(p->associated_torrent().lock().get() == this); if (p->is_disconnecting()) + { m_connections.erase(j); + continue; + } if (p->outstanding_bytes() > 0) {