*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-02-26 18:55:10 +00:00
parent faac4f5b32
commit 23936310d2
4 changed files with 30 additions and 20 deletions

View File

@ -18,6 +18,7 @@ project torrent
<include>./include
<include>$(BOOST_ROOT)
<variant>release:<define>NDEBUG
<define>BOOST_ALL_NO_LIB
# devstudio switches

View File

@ -170,7 +170,7 @@ namespace libtorrent
peer* find_unchoke_candidate();
void connect_peer(peer *);
bool connect_peer(peer *);
bool connect_one_peer();

View File

@ -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()

View File

@ -290,7 +290,7 @@ namespace libtorrent { namespace detail
{
m_connections.erase(m_disconnect_peer.back());
m_disconnect_peer.pop_back();
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
}
}
@ -403,7 +403,7 @@ namespace libtorrent { namespace detail
boost::mutex::scoped_lock l(m_mutex);
// +1 for the listen socket
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
if (m_abort)
{
@ -466,7 +466,7 @@ namespace libtorrent { namespace detail
m_selector.remove(*i);
m_connections.erase(p);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
t->abort();
}
catch (std::exception& e)
@ -481,7 +481,7 @@ namespace libtorrent { namespace detail
m_selector.remove(*i);
m_connections.erase(p);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
}
}
}
@ -556,7 +556,7 @@ namespace libtorrent { namespace detail
m_selector.remove(*i);
m_connections.erase(p);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
t->abort();
}
catch (std::exception& e)
@ -570,7 +570,7 @@ namespace libtorrent { namespace detail
// from the connection-list
m_selector.remove(*i);
m_connections.erase(p);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
}
}
}
@ -603,7 +603,7 @@ namespace libtorrent { namespace detail
if (p != m_connections.end())
{
m_connections.erase(p);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
}
}
@ -644,7 +644,7 @@ namespace libtorrent { namespace detail
}
m_selector.remove(j->first);
m_connections.erase(j);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + 1);
assert(m_selector.count_read_monitors() == (int)m_connections.size() + (bool)m_listen_socket);
continue;
}