upload only fix

This commit is contained in:
Arvid Norberg 2009-12-05 16:46:10 +00:00
parent a6ed83e7fe
commit d84c59d13b
3 changed files with 6 additions and 5 deletions

View File

@ -168,10 +168,7 @@ namespace libtorrent
void set_upload_mode(bool b);
bool upload_mode() const { return m_upload_mode; }
bool is_upload_only() const
{
return (((is_finished() && !super_seeding()) || upload_mode())
&& !m_ses.settings().lazy_bitfields);
}
{ return (is_finished() || upload_mode()) && !super_seeding(); }
int seed_rank(session_settings const& s) const;

View File

@ -1844,7 +1844,7 @@ namespace libtorrent
// 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
if (t->is_upload_only())
if (t->is_upload_only() && !m_ses.settings().lazy_bitfields)
handshake["upload_only"] = 1;
tcp::endpoint ep = m_ses.get_ipv6_interface();

View File

@ -4976,6 +4976,10 @@ namespace libtorrent
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;
boost::shared_ptr<torrent> t = associated_torrent().lock();
t->get_policy().set_seed(m_peer_info, u);