Beispiel #1
0
		void peer_lost(int index, peer_connection const* peer)
		{
			if (has_picker())
			{
				m_picker->dec_refcount(index, peer);
			}
#ifdef TORRENT_DEBUG
			else
			{
				TORRENT_ASSERT(is_seed());
			}
#endif
		}
Beispiel #2
0
		void peer_has_all(peer_connection const* peer)
		{
			if (has_picker())
			{
				m_picker->inc_refcount_all(peer);
			}
#ifdef TORRENT_DEBUG
			else
			{
				TORRENT_ASSERT(is_seed());
			}
#endif
		}
Beispiel #3
0
		void peer_has_all()
		{
			if (has_picker())
			{
				m_picker->inc_refcount_all();
			}
#ifdef TORRENT_DEBUG
			else
			{
				TORRENT_ASSERT(is_seed());
			}
#endif
		}
Beispiel #4
0
		void peer_lost(bitfield const& bits, peer_connection const* peer)
		{
			if (has_picker())
			{
				if (bits.all_set() && bits.size() > 0)
					m_picker->dec_refcount_all(peer);
				else
					m_picker->dec_refcount(bits, peer);
			}
#ifdef TORRENT_DEBUG
			else
			{
				TORRENT_ASSERT(is_seed());
			}
#endif
		}
Beispiel #5
0
		void peer_lost(bitfield const& bits)
		{
			if (has_picker())
			{
				if (bits.all_set())
					m_picker->dec_refcount_all();
				else
					m_picker->dec_refcount(bits);
			}
#ifdef TORRENT_DEBUG
			else
			{
				TORRENT_ASSERT(is_seed());
			}
#endif
		}
Beispiel #6
0
		int num_have() const
		{
			return has_picker()
				? m_picker->num_have()
				: m_torrent_file->num_pieces();
		}
Beispiel #7
0
		// returns true if we have downloaded the given piece
		bool have_piece(int index) const
		{
			if (!valid_metadata()) return false;
			if (!has_picker()) return true;
			return m_picker->have_piece(index);
		}
Beispiel #8
0
		// returns true if we have downloaded the given piece
		bool have_piece(int index) const
		{
			return has_picker()?m_picker->have_piece(index):true;
		}