added option to set peers in a state where it doesn't download

This commit is contained in:
Arvid Norberg 2008-11-06 08:34:56 +00:00
parent 19c66a1826
commit 3412c0f709
3 changed files with 13 additions and 1 deletions

View File

@ -198,6 +198,9 @@ namespace libtorrent
void request_large_blocks(bool b)
{ m_request_large_blocks = b; }
bool no_download() const { return m_no_download; }
void no_download(bool b) { m_no_download = b; }
void set_priority(int p)
{ m_priority = p; }
@ -318,6 +321,8 @@ namespace libtorrent
bool on_local_network() const;
bool ignore_bandwidth_limits() const
{ return m_ignore_bandwidth_limits; }
void ignore_bandwidth_limits(bool i)
{ m_ignore_bandwidth_limits = i; }
bool failed() const { return m_failed; }
@ -661,7 +666,7 @@ namespace libtorrent
// this is the torrent this connection is
// associated with. If the connection is an
// incoming conncetion, this is set to zero
// incoming connection, this is set to zero
// until the info_hash is received. Then it's
// set to the torrent it belongs to.
boost::weak_ptr<torrent> m_torrent;
@ -870,6 +875,10 @@ namespace libtorrent
// this is set to true once the bitfield is received
bool m_bitfield_received:1;
// if this is set to true, the client will not
// pick any pieces from this peer
bool m_no_download:1;
#ifndef NDEBUG
public:
bool m_in_constructor:1;

View File

@ -130,6 +130,7 @@ namespace libtorrent
, m_upload_only(false)
, m_snubbed(false)
, m_bitfield_received(false)
, m_no_download(false)
#ifndef NDEBUG
, m_in_constructor(true)
, m_disconnect_started(false)
@ -237,6 +238,7 @@ namespace libtorrent
, m_upload_only(false)
, m_snubbed(false)
, m_bitfield_received(false)
, m_no_download(false)
#ifndef NDEBUG
, m_in_constructor(true)
, m_disconnect_started(false)

View File

@ -179,6 +179,7 @@ namespace libtorrent
void request_a_block(torrent& t, peer_connection& c)
{
if (t.is_seed()) return;
if (c.no_download()) return;
TORRENT_ASSERT(t.valid_metadata());
TORRENT_ASSERT(c.peer_info_struct() != 0 || !dynamic_cast<bt_peer_connection*>(&c));