upload only fix
This commit is contained in:
parent
a6ed83e7fe
commit
d84c59d13b
|
@ -168,10 +168,7 @@ namespace libtorrent
|
||||||
void set_upload_mode(bool b);
|
void set_upload_mode(bool b);
|
||||||
bool upload_mode() const { return m_upload_mode; }
|
bool upload_mode() const { return m_upload_mode; }
|
||||||
bool is_upload_only() const
|
bool is_upload_only() const
|
||||||
{
|
{ return (is_finished() || upload_mode()) && !super_seeding(); }
|
||||||
return (((is_finished() && !super_seeding()) || upload_mode())
|
|
||||||
&& !m_ses.settings().lazy_bitfields);
|
|
||||||
}
|
|
||||||
|
|
||||||
int seed_rank(session_settings const& s) const;
|
int seed_rank(session_settings const& s) const;
|
||||||
|
|
||||||
|
|
|
@ -1844,7 +1844,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// if we're using lazy bitfields or if we're super seeding, don't say
|
// if we're using lazy bitfields or if we're super seeding, don't say
|
||||||
// we're upload only, since it might make peers disconnect
|
// we're upload only, since it might make peers disconnect
|
||||||
if (t->is_upload_only())
|
if (t->is_upload_only() && !m_ses.settings().lazy_bitfields)
|
||||||
handshake["upload_only"] = 1;
|
handshake["upload_only"] = 1;
|
||||||
|
|
||||||
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
||||||
|
|
|
@ -4976,6 +4976,10 @@ namespace libtorrent
|
||||||
|
|
||||||
void peer_connection::set_upload_only(bool u)
|
void peer_connection::set_upload_only(bool u)
|
||||||
{
|
{
|
||||||
|
// if the peer is a seed, don't allow setting
|
||||||
|
// upload_only to false
|
||||||
|
if (m_upload_only && is_seed()) return;
|
||||||
|
|
||||||
m_upload_only = u;
|
m_upload_only = u;
|
||||||
boost::shared_ptr<torrent> t = associated_torrent().lock();
|
boost::shared_ptr<torrent> t = associated_torrent().lock();
|
||||||
t->get_policy().set_seed(m_peer_info, u);
|
t->get_policy().set_seed(m_peer_info, u);
|
||||||
|
|
Loading…
Reference in New Issue