From d18b1612e4bfeebb75dec5ac5004f113ceb64a86 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 8 Mar 2010 01:54:56 +0000 Subject: [PATCH] more asserts to try to catch crash in disconnect_peers --- src/torrent.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index b0eb86832..e1acb2de0 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -4422,7 +4422,12 @@ namespace libtorrent peer_connection* p = *i; ++ret; + TORRENT_ASSERT(p->associated_torrent().lock().get() == this); +#ifdef TORRENT_DEBUG + int num_conns = m_connections.size(); +#endif p->disconnect(errors::optimistic_disconnect); + TORRENT_ASSERT(m_connections.size() == num_conns - 1); } return ret; @@ -5101,6 +5106,8 @@ namespace libtorrent int scale = 100; if (!is_seed()) scale = 50; + if (num == 0) return 0; + int ret = 0; ptime now = time_now();