removed sparse-regions support

This commit is contained in:
arvidn 2015-06-29 20:40:32 -04:00
parent d887f5719d
commit d1670c72c2
10 changed files with 28 additions and 135 deletions

View File

@ -1,3 +1,4 @@
* removed sparse-regions feature
* support using 0 disk threads (to perform disk I/O in network thread)
* removed deprecated handle_alert template
* enable logging build config by default (but alert mask disabled by default)

View File

@ -91,7 +91,6 @@ void bind_torrent_status()
.def_readonly("seed_rank", &torrent_status::seed_rank)
.def_readonly("last_scrape", &torrent_status::last_scrape)
.def_readonly("has_incoming", &torrent_status::has_incoming)
.def_readonly("sparse_regions", &torrent_status::sparse_regions)
.def_readonly("seed_mode", &torrent_status::seed_mode)
.def_readonly("upload_mode", &torrent_status::upload_mode)
.def_readonly("share_mode", &torrent_status::share_mode)

View File

@ -245,8 +245,6 @@ namespace libtorrent
// one past the last piece we do not have.
int reverse_cursor() const { return m_reverse_cursor; }
int sparse_regions() const { return m_sparse_regions; }
// sets all pieces to dont-have
void init(int blocks_per_piece, int blocks_in_last_piece, int total_num_pieces);
int num_pieces() const { return int(m_piece_map.size()); }
@ -821,9 +819,6 @@ namespace libtorrent
// all the subsequent pieces
int m_reverse_cursor;
// the number of regions of pieces we don't have.
int m_sparse_regions;
// the number of pieces we have (i.e. passed + flushed).
// This includes pieces that we have filtered but still have
int m_num_have;

View File

@ -1083,17 +1083,6 @@ namespace libtorrent
// favour of a choked peer.
seeding_piece_quota,
// ``max_sparse_regions`` is a limit of the number of *sparse regions*
// in a torrent. A sparse region is defined as a hole of pieces we
// have not yet downloaded, in between pieces that have been
// downloaded. This is used as a hack for windows vista which has a
// bug where you cannot write files with more than a certain number of
// sparse regions. This limit is not hard, it will be exceeded. Once
// it's exceeded, pieces that will maintain or decrease the number of
// sparse regions are prioritized. To disable this functionality, set
// this to 0. It defaults to 0 on all platforms except windows.
max_sparse_regions,
// TODO: deprecate this
// ``max_rejects`` is the number of piece requests we will reject in a
// row while a peer is choked before the peer is considered abusive

View File

@ -1145,8 +1145,6 @@ namespace libtorrent
private:
void update_sparse_piece_prio(int piece, int start, int end);
void ip_filter_updated();
void inc_stats_counter(int c, int value = 1);
@ -1537,11 +1535,6 @@ namespace libtorrent
// does not count when the torrent is stopped or paused
unsigned int m_seeding_time:24;
// this is a counter that is decreased every
// second, and when it reaches 0, the peer_list::pulse()
// is called and the time scaler is reset to 10.
boost::int8_t m_time_scaler;
// ----
// the maximum number of uploads for this torrent

View File

@ -1581,11 +1581,6 @@ namespace libtorrent
// If it has never done that, this value is -1.
int last_scrape;
// the number of regions of non-downloaded pieces in the torrent. This is
// an interesting metric on windows vista, since there is a limit on the
// number of sparse regions in a single file there.
int sparse_regions;
// the priority of this torrent
int priority;

View File

@ -80,7 +80,6 @@ namespace libtorrent
, m_num_have_filtered(0)
, m_cursor(0)
, m_reverse_cursor(0)
, m_sparse_regions(1)
, m_num_have(0)
, m_num_pad_files(0)
, m_dirty(false)
@ -1698,27 +1697,6 @@ namespace libtorrent
erase_download_piece(i);
}
// maintain sparse_regions
if (index == 0)
{
if (index == int(m_piece_map.size()) - 1
|| m_piece_map[index + 1].have())
--m_sparse_regions;
}
else if (index == int(m_piece_map.size() - 1))
{
if (index == 0
|| m_piece_map[index - 1].have())
--m_sparse_regions;
}
else
{
bool have_before = m_piece_map[index-1].have();
bool have_after = m_piece_map[index+1].have();
if (have_after && have_before) --m_sparse_regions;
else if (!have_after && !have_before) ++m_sparse_regions;
}
if (p.filtered())
{
--m_num_filtered;
@ -2649,7 +2627,6 @@ get_out:
, first_block);
}
int piece_picker::add_blocks(int piece
, bitfield const& pieces
, std::vector<piece_block>& interesting_blocks

View File

@ -275,11 +275,6 @@ namespace libtorrent
SET(min_announce_interval, 5 * 60, 0),
SET(auto_manage_startup, 60, 0),
SET(seeding_piece_quota, 20, 0),
#ifdef TORRENT_WINDOWS
SET(max_sparse_regions, 30000, 0),
#else
SET(max_sparse_regions, 0, 0),
#endif
SET(max_rejects, 50, 0),
SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size),
SET(send_socket_buffer_size, 0, &session_impl::update_socket_buffer_size),

View File

@ -238,7 +238,6 @@ namespace libtorrent
#endif
, m_need_save_resume_data(true)
, m_seeding_time(0)
, m_time_scaler(0)
, m_max_uploads((1<<24)-1)
, m_save_resume_flags(0)
, m_num_uploads(0)
@ -4077,20 +4076,6 @@ namespace libtorrent
}
void torrent::update_sparse_piece_prio(int i, int start, int end)
{
TORRENT_ASSERT(m_picker);
if (m_picker->have_piece(i) || m_picker->piece_priority(i) == 0)
return;
bool have_before = i < start || m_picker->have_piece(i - 1);
bool have_after = i >= end || m_picker->have_piece(i + 1);
if (have_after && have_before)
m_picker->set_piece_priority(i, 7);
else if (have_after || have_before)
m_picker->set_piece_priority(i, 6);
update_gauge();
}
// this is called once we have completely downloaded piece
// 'index', its hash has been verified. It's also called
// during initial file check when we find a piece whose hash
@ -4139,20 +4124,6 @@ namespace libtorrent
else p->fill_send_buffer();
}
if (settings().get_int(settings_pack::max_sparse_regions) > 0
&& has_picker()
&& m_picker->sparse_regions() > settings().get_int(settings_pack::max_sparse_regions))
{
// we have too many sparse regions. Prioritize pieces
// that won't introduce new sparse regions
// prioritize pieces that will reduce the number of sparse
// regions even higher
int start = m_picker->cursor();
int end = m_picker->reverse_cursor();
if (index > start) update_sparse_piece_prio(index - 1, start, end);
if (index < end - 1) update_sparse_piece_prio(index + 1, start, end);
}
#ifndef TORRENT_DISABLE_EXTENSIONS
for (extension_list_t::iterator i = m_extensions.begin()
, end(m_extensions.end()); i != end; ++i)
@ -9817,26 +9788,6 @@ namespace libtorrent
if (m_need_suggest_pieces_refresh)
do_refresh_suggest_pieces();
m_time_scaler--;
if (m_time_scaler <= 0)
{
m_time_scaler = 10;
if (settings().get_int(settings_pack::max_sparse_regions) > 0
&& has_picker()
&& m_picker->sparse_regions() > settings().get_int(settings_pack::max_sparse_regions))
{
// we have too many sparse regions. Prioritize pieces
// that won't introduce new sparse regions
// prioritize pieces that will reduce the number of sparse
// regions even higher
int start = m_picker->cursor();
int end = m_picker->reverse_cursor();
for (int i = start; i < end; ++i)
update_sparse_piece_prio(i, start, end);
}
}
if (settings().get_bool(settings_pack::rate_limit_ip_overhead))
{
int up_limit = upload_limit();
@ -11636,7 +11587,6 @@ namespace libtorrent
int num_pieces = m_torrent_file->num_pieces();
if (has_picker() && (flags & torrent_handle::query_pieces))
{
st->sparse_regions = m_picker->sparse_regions();
st->pieces.resize(num_pieces, false);
for (int i = 0; i < num_pieces; ++i)
if (m_picker->has_piece_passed(i)) st->pieces.set_bit(i);

View File

@ -119,7 +119,6 @@ namespace libtorrent
, seeding_time(0)
, seed_rank(0)
, last_scrape(0)
, sparse_regions(0)
, priority(0)
, state(checking_resume_data)
, need_save_resume(false)