diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 4bc33f85d..81434f722 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -101,6 +101,10 @@ namespace libtorrent , num_seeds(0) , distributed_copies(0.f) , block_size(0) + , num_uploads(0) + , num_connections(0) + , uploads_limit(0) + , connections_limit(0) {} enum state_t @@ -202,6 +206,11 @@ namespace libtorrent // the number of bytes each piece request asks for // and each bit in the download queue bitfield represents int block_size; + + int num_uploads; + int num_connections; + int uploads_limit; + int connections_limit; }; struct TORRENT_EXPORT block_info diff --git a/src/torrent.cpp b/src/torrent.cpp index fb2e29ce5..ed1dc1d9b 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -204,7 +204,7 @@ namespace libtorrent m_initial_done = 0; #endif - m_uploads_quota.min = 2; + m_uploads_quota.min = 0; m_connections_quota.min = 2; // this will be corrected the next time the main session // distributes resources, i.e. on average in 0.5 seconds @@ -277,7 +277,7 @@ namespace libtorrent if (name) m_name.reset(new std::string(name)); - m_uploads_quota.min = 2; + m_uploads_quota.min = 0; m_connections_quota.min = 2; // this will be corrected the next time the main session // distributes resources, i.e. on average in 0.5 seconds @@ -2508,7 +2508,7 @@ namespace libtorrent #endif m_paused = false; - m_uploads_quota.min = 2; + m_uploads_quota.min = 0; m_connections_quota.min = 2; m_uploads_quota.max = std::numeric_limits::max(); m_connections_quota.max = std::numeric_limits::max(); @@ -2527,6 +2527,7 @@ namespace libtorrent m_connections_quota.used = (int)m_connections.size(); m_uploads_quota.used = m_policy->num_uploads(); + m_uploads_quota.max = (int)m_connections.size(); #ifndef TORRENT_DISABLE_EXTENSIONS for (extension_list_t::iterator i = m_extensions.begin() @@ -2741,6 +2742,10 @@ namespace libtorrent = m_trackers[m_last_working_tracker].url; } + st.num_uploads = m_uploads_quota.used; + st.uploads_limit = m_uploads_quota.given; + st.num_connections = m_connections_quota.used; + st.connections_limit = m_connections_quota.given; // if we don't have any metadata, stop here if (!valid_metadata())