added btgdaemon to identify client and applied wojci's patch to add num_connections() and num_uploads() to session

This commit is contained in:
Arvid Norberg
2007-01-01 21:04:30 +00:00
parent 373b18233a
commit 0f3874028b
6 changed files with 44 additions and 2 deletions

View File

@@ -1633,6 +1633,7 @@ namespace libtorrent { namespace detail
{
assert(limit > 0 || limit == -1);
mutex_t::scoped_lock l(m_mutex);
m_half_open_limit = limit;
}
@@ -1643,6 +1644,25 @@ namespace libtorrent { namespace detail
m_upload_rate = bytes_per_second;
}
int session_impl::num_uploads() const
{
int uploads = 0;
mutex_t::scoped_lock l(m_mutex);
for (torrent_map::const_iterator i = m_torrents.begin()
, end(m_torrents.end()); i != end; i++)
{
uploads += i->second->get_policy().num_uploads();
}
return uploads;
}
int session_impl::num_connections() const
{
mutex_t::scoped_lock l(m_mutex);
return m_connections.size() + m_half_open.size();
}
std::auto_ptr<alert> session_impl::pop_alert()
{
mutex_t::scoped_lock l(m_mutex);