*** empty log message ***
This commit is contained in:
@@ -777,7 +777,7 @@ namespace libtorrent
|
||||
|
||||
if (i->banned) return;
|
||||
|
||||
if(m_torrent->num_peers() < m_max_connections)
|
||||
if (m_torrent->num_peers() < m_max_connections)
|
||||
{
|
||||
connect_peer(&*i);
|
||||
}
|
||||
@@ -909,19 +909,28 @@ namespace libtorrent
|
||||
assert(!p->connection);
|
||||
assert(p->type==peer::connectable);
|
||||
|
||||
connect_peer(p);
|
||||
return true;
|
||||
return connect_peer(p);
|
||||
}
|
||||
|
||||
void policy::connect_peer(peer *p)
|
||||
bool policy::connect_peer(peer *p)
|
||||
{
|
||||
p->connection = &m_torrent->connect_to_peer(p->id);
|
||||
p->connection->add_stat(p->prev_amount_download, p->prev_amount_upload);
|
||||
p->prev_amount_download = 0;
|
||||
p->prev_amount_upload = 0;
|
||||
p->connected =
|
||||
m_last_optimistic_disconnect =
|
||||
boost::posix_time::second_clock::local_time();
|
||||
try
|
||||
{
|
||||
p->connection = &m_torrent->connect_to_peer(p->id);
|
||||
p->connection->add_stat(p->prev_amount_download, p->prev_amount_upload);
|
||||
p->prev_amount_download = 0;
|
||||
p->prev_amount_upload = 0;
|
||||
p->connected =
|
||||
m_last_optimistic_disconnect =
|
||||
boost::posix_time::second_clock::local_time();
|
||||
return true;
|
||||
}
|
||||
catch (network_error&)
|
||||
{
|
||||
// TODO: remove the peer
|
||||
// m_peers.erase(std::find(m_peers.begin(), m_peers.end(), p));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool policy::disconnect_one_peer()
|
||||
|
Reference in New Issue
Block a user