fix to make torrent_status::list_peers more accurate
This commit is contained in:
parent
f20f63f865
commit
2da772210c
|
@ -60,6 +60,7 @@ release 0.14.5
|
||||||
|
|
||||||
* fixed bug when handling malformed webseed urls and an http proxy
|
* fixed bug when handling malformed webseed urls and an http proxy
|
||||||
* fixed bug when setting unlimited upload or download rates for torrents
|
* fixed bug when setting unlimited upload or download rates for torrents
|
||||||
|
* fix to make torrent_status::list_peers more accurate.
|
||||||
|
|
||||||
release 0.14.4
|
release 0.14.4
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace libtorrent
|
||||||
|
|
||||||
void ip_filter_updated();
|
void ip_filter_updated();
|
||||||
|
|
||||||
|
void set_seed(policy::peer* p, bool s);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
bool has_connection(const peer_connection* p);
|
bool has_connection(const peer_connection* p);
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,7 @@ namespace libtorrent
|
||||||
<< " *** on_metadata(): THIS IS A SEED ***\n";
|
<< " *** on_metadata(): THIS IS A SEED ***\n";
|
||||||
#endif
|
#endif
|
||||||
// if this is a web seed. we don't have a peer_info struct
|
// if this is a web seed. we don't have a peer_info struct
|
||||||
if (m_peer_info) m_peer_info->seed = true;
|
t->get_policy().set_seed(m_peer_info, true);
|
||||||
m_upload_only = true;
|
m_upload_only = true;
|
||||||
|
|
||||||
t->peer_has_all();
|
t->peer_has_all();
|
||||||
|
@ -591,7 +591,7 @@ namespace libtorrent
|
||||||
(*m_logger) << " *** THIS IS A SEED ***\n";
|
(*m_logger) << " *** THIS IS A SEED ***\n";
|
||||||
#endif
|
#endif
|
||||||
// if this is a web seed. we don't have a peer_info struct
|
// if this is a web seed. we don't have a peer_info struct
|
||||||
if (m_peer_info) m_peer_info->seed = true;
|
t->get_policy().set_seed(m_peer_info, true);
|
||||||
m_upload_only = true;
|
m_upload_only = true;
|
||||||
|
|
||||||
t->peer_has_all();
|
t->peer_has_all();
|
||||||
|
@ -1361,7 +1361,7 @@ namespace libtorrent
|
||||||
// decrement the piece count without first incrementing it
|
// decrement the piece count without first incrementing it
|
||||||
if (is_seed())
|
if (is_seed())
|
||||||
{
|
{
|
||||||
m_peer_info->seed = true;
|
t->get_policy().set_seed(m_peer_info, true);
|
||||||
m_upload_only = true;
|
m_upload_only = true;
|
||||||
disconnect_if_redundant();
|
disconnect_if_redundant();
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
|
@ -1437,7 +1437,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_have_piece = bits;
|
m_have_piece = bits;
|
||||||
m_num_pieces = bits.count();
|
m_num_pieces = bits.count();
|
||||||
if (m_peer_info) m_peer_info->seed = (m_num_pieces == int(bits.size()));
|
t->get_policy().set_seed(m_peer_info, m_num_pieces == int(bits.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ namespace libtorrent
|
||||||
(*m_logger) << " *** THIS IS A SEED ***\n";
|
(*m_logger) << " *** THIS IS A SEED ***\n";
|
||||||
#endif
|
#endif
|
||||||
// if this is a web seed. we don't have a peer_info struct
|
// if this is a web seed. we don't have a peer_info struct
|
||||||
if (m_peer_info) m_peer_info->seed = true;
|
t->get_policy().set_seed(m_peer_info, true);
|
||||||
m_upload_only = true;
|
m_upload_only = true;
|
||||||
|
|
||||||
m_have_piece.set_all();
|
m_have_piece.set_all();
|
||||||
|
@ -2212,7 +2212,7 @@ namespace libtorrent
|
||||||
|
|
||||||
m_have_all = true;
|
m_have_all = true;
|
||||||
|
|
||||||
if (m_peer_info) m_peer_info->seed = true;
|
t->get_policy().set_seed(m_peer_info, true);
|
||||||
m_upload_only = true;
|
m_upload_only = true;
|
||||||
m_bitfield_received = true;
|
m_bitfield_received = true;
|
||||||
|
|
||||||
|
@ -2273,7 +2273,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
if (m_peer_info) m_peer_info->seed = false;
|
t->get_policy().set_seed(m_peer_info, false);
|
||||||
m_bitfield_received = true;
|
m_bitfield_received = true;
|
||||||
|
|
||||||
// we're never interested in a peer that doesn't have anything
|
// we're never interested in a peer that doesn't have anything
|
||||||
|
|
|
@ -895,6 +895,15 @@ namespace libtorrent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void policy::set_seed(policy::peer* p, bool s)
|
||||||
|
{
|
||||||
|
if (p == 0) return;
|
||||||
|
if (p->seed == s) return;
|
||||||
|
p->seed = s;
|
||||||
|
if (s) ++m_num_seeds;
|
||||||
|
else --m_num_seeds;
|
||||||
|
}
|
||||||
|
|
||||||
policy::peer* policy::add_peer(tcp::endpoint const& remote, peer_id const& pid
|
policy::peer* policy::add_peer(tcp::endpoint const& remote, peer_id const& pid
|
||||||
, int src, char flags)
|
, int src, char flags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue