fix in the smart_ban to not use invalid pointers

This commit is contained in:
Arvid Norberg
2007-12-27 20:57:58 +00:00
parent b2a49d2db9
commit 8a47c849ce
3 changed files with 15 additions and 2 deletions

View File

@@ -1035,6 +1035,17 @@ namespace libtorrent
p->source |= src;
}
bool policy::has_peer(policy::peer const* p) const
{
// find p in m_peers
for (std::multimap<address, peer>::const_iterator i = m_peers.begin()
, end(m_peers.end()); i != end; ++i)
{
if (&i->second == p) return true;
}
return false;
}
policy::peer* policy::peer_from_tracker(tcp::endpoint const& remote, peer_id const& pid
, int src, char flags)
{