added has_incoming to torrent_status per #315

This commit is contained in:
Arvid Norberg 2008-06-05 18:19:03 +00:00
parent 59c8a74ba8
commit bcc24bf831
5 changed files with 640 additions and 617 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2228,6 +2228,8 @@ It contains the following fields::
int seed_rank; int seed_rank;
int last_scrape; int last_scrape;
bool has_incoming;
}; };
``progress`` is a value in the range [0, 1], that represents the progress of the ``progress`` is a value in the range [0, 1], that represents the progress of the
@ -2410,6 +2412,9 @@ to seed ratio from the tracker scrape. For more information, see queuing_.
``last_scrape`` is the number of seconds since this torrent acquired scrape data. ``last_scrape`` is the number of seconds since this torrent acquired scrape data.
If it has never done that, this value is -1. If it has never done that, this value is -1.
``has_incoming`` is true if there has ever been an incoming connection attempt
to this torrent.'
peer_info peer_info
========= =========

View File

@ -909,6 +909,10 @@ namespace libtorrent
// has been initialized with files_checked(). // has been initialized with files_checked().
bool m_connections_initialized:1; bool m_connections_initialized:1;
// is set to true every time there is an incoming
// connection to this torrent
bool m_has_incoming:1;
#ifndef NDEBUG #ifndef NDEBUG
bool m_files_checked:1; bool m_files_checked:1;
#endif #endif

View File

@ -120,6 +120,7 @@ namespace libtorrent
, seeding_time(0) , seeding_time(0)
, seed_rank(0) , seed_rank(0)
, last_scrape(0) , last_scrape(0)
, has_incoming(false)
{} {}
enum state_t enum state_t
@ -266,6 +267,10 @@ namespace libtorrent
// number of seconds since last scrape, or -1 if // number of seconds since last scrape, or -1 if
// there hasn't been a scrape // there hasn't been a scrape
int last_scrape; int last_scrape;
// true if there are incoming connections to this
// torrent
bool has_incoming;
}; };
struct TORRENT_EXPORT block_info struct TORRENT_EXPORT block_info

View File

@ -201,6 +201,7 @@ namespace libtorrent
, m_sequential_download(false) , m_sequential_download(false)
, m_got_tracker_response(false) , m_got_tracker_response(false)
, m_connections_initialized(true) , m_connections_initialized(true)
, m_has_incoming(false)
{ {
if (resume_data) m_resume_data = *resume_data; if (resume_data) m_resume_data = *resume_data;
#ifndef NDEBUG #ifndef NDEBUG
@ -275,6 +276,7 @@ namespace libtorrent
, m_sequential_download(false) , m_sequential_download(false)
, m_got_tracker_response(false) , m_got_tracker_response(false)
, m_connections_initialized(false) , m_connections_initialized(false)
, m_has_incoming(false)
{ {
if (resume_data) m_resume_data = *resume_data; if (resume_data) m_resume_data = *resume_data;
#ifndef NDEBUG #ifndef NDEBUG
@ -2714,6 +2716,8 @@ namespace libtorrent
TORRENT_ASSERT(p != 0); TORRENT_ASSERT(p != 0);
TORRENT_ASSERT(!p->is_local()); TORRENT_ASSERT(!p->is_local());
m_has_incoming = true;
if ((m_state == torrent_status::queued_for_checking if ((m_state == torrent_status::queued_for_checking
|| m_state == torrent_status::checking_files) || m_state == torrent_status::checking_files)
&& valid_metadata()) && valid_metadata())
@ -3912,6 +3916,7 @@ namespace libtorrent
torrent_status st; torrent_status st;
st.has_incoming = m_has_incoming;
st.error = m_error; st.error = m_error;
if (m_last_scrape == min_time()) if (m_last_scrape == min_time())