diff --git a/src/policy.cpp b/src/policy.cpp index 0c7d21969..0973e3746 100755 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1340,10 +1340,12 @@ namespace libtorrent int total_connections = 0; int nonempty_connections = 0; - + std::set
unique_test; for (const_iterator i = m_peers.begin(); i != m_peers.end(); ++i) { + assert(unique_test.find(i->ip.address()) == unique_test.end()); + unique_test.insert(i->ip.address()); ++total_connections; if (!i->connection) continue; assert(i->connection->peer_info_struct() == 0 @@ -1381,9 +1383,6 @@ namespace libtorrent && connected_peers > 0) || (connected_peers + 1 == num_torrent_peers && num_torrent_peers > 0)); - - // TODO: Make sure the number of peers in m_torrent is equal - // to the number of connected peers in m_peers. } #endif diff --git a/src/torrent.cpp b/src/torrent.cpp index 219215d29..16a2e3d2c 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1693,7 +1693,11 @@ namespace libtorrent assert(peerinfo); assert(peerinfo->connection == 0); - assert(m_connections.find(peerinfo->ip) == m_connections.end()); +#ifndef NDEBUG + peer_iterator i_ = m_connections.find(peerinfo->ip); + assert(i_ == m_connections.end() + || (i_->second->is_disconnecting())); +#endif assert(want_more_peers());