removed unneccesary connection lookup in connect_peer

This commit is contained in:
Arvid Norberg 2007-05-04 16:35:29 +00:00
parent c871167ec3
commit 983f4bc02e
1 changed files with 4 additions and 4 deletions

View File

@ -1888,6 +1888,10 @@ namespace libtorrent
{
INVARIANT_CHECK;
assert(peerinfo);
assert(peerinfo->connection == 0);
assert(m_connections.find(peerinfo->ip) == m_connections.end());
if (!want_more_peers()) return 0;
tcp::endpoint const& a(peerinfo->ip);
@ -1901,8 +1905,6 @@ namespace libtorrent
return 0;
}
if (m_connections.find(a) != m_connections.end()) return 0;
boost::shared_ptr<socket_type> s
= instantiate_connection(m_ses.m_io_service, m_ses.peer_proxy());
boost::intrusive_ptr<peer_connection> c(new bt_peer_connection(
@ -1925,8 +1927,6 @@ namespace libtorrent
{
m_ses.m_connection_queue.push_back(c);
assert(m_connections.find(a) == m_connections.end());
#ifndef NDEBUG
m_policy->check_invariant();
#endif