forked from premiere/premiere-libtorrent
added clear_piece_deadlines() to remove all piece deadlines
This commit is contained in:
parent
4deafb5e29
commit
ea77427e07
|
@ -1,5 +1,6 @@
|
||||||
1.0 release
|
1.0 release
|
||||||
|
|
||||||
|
* added clear_piece_deadlines() to remove all piece deadlines
|
||||||
* improve queuing logic of inactive torrents (dont_count_slow_torrents)
|
* improve queuing logic of inactive torrents (dont_count_slow_torrents)
|
||||||
* expose optimistic unchoke logic to plugins
|
* expose optimistic unchoke logic to plugins
|
||||||
* fix issue with large UDP packets on windows
|
* fix issue with large UDP packets on windows
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
* fix uTP edge case where udp socket buffer fills up
|
* fix uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* fix nagle implementation in uTP
|
||||||
|
|
||||||
|
* added work-around for MingW issue in file I/O
|
||||||
* fixed sparse file detection on windows
|
* fixed sparse file detection on windows
|
||||||
* fixed bug in gunzip
|
* fixed bug in gunzip
|
||||||
* fix to use proxy settings when adding .torrent file from URL
|
* fix to use proxy settings when adding .torrent file from URL
|
||||||
|
|
|
@ -345,6 +345,7 @@ namespace libtorrent
|
||||||
|
|
||||||
void set_piece_deadline(int piece, int t, int flags);
|
void set_piece_deadline(int piece, int t, int flags);
|
||||||
void reset_piece_deadline(int piece);
|
void reset_piece_deadline(int piece);
|
||||||
|
void clear_time_critical();
|
||||||
void update_piece_priorities();
|
void update_piece_priorities();
|
||||||
|
|
||||||
void status(torrent_status* st, boost::uint32_t flags);
|
void status(torrent_status* st, boost::uint32_t flags);
|
||||||
|
|
|
@ -362,8 +362,12 @@ namespace libtorrent
|
||||||
// ``reset_piece_deadline`` removes the deadline from the piece. If it
|
// ``reset_piece_deadline`` removes the deadline from the piece. If it
|
||||||
// hasn't already been downloaded, it will no longer be considered a
|
// hasn't already been downloaded, it will no longer be considered a
|
||||||
// priority.
|
// priority.
|
||||||
|
//
|
||||||
|
// ``clear_piece_deadlines()`` removes deadlines on all pieces in
|
||||||
|
// the torrent. As if reset_piece_deadline() was called on all pieces.
|
||||||
void set_piece_deadline(int index, int deadline, int flags = 0) const;
|
void set_piece_deadline(int index, int deadline, int flags = 0) const;
|
||||||
void reset_piece_deadline(int index) const;
|
void reset_piece_deadline(int index) const;
|
||||||
|
void clear_piece_deadlines() const;
|
||||||
|
|
||||||
// This sets the bandwidth priority of this torrent. The priority of a
|
// This sets the bandwidth priority of this torrent. The priority of a
|
||||||
// torrent determines how much bandwidth its peers are assigned when
|
// torrent determines how much bandwidth its peers are assigned when
|
||||||
|
|
|
@ -3827,6 +3827,22 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrent::clear_time_critical()
|
||||||
|
{
|
||||||
|
for (std::deque<time_critical_piece>::iterator i = m_time_critical_pieces.begin();
|
||||||
|
i != m_time_critical_pieces.end();)
|
||||||
|
{
|
||||||
|
if (i->flags & torrent_handle::alert_when_available)
|
||||||
|
{
|
||||||
|
// post an empty read_piece_alert to indicate it failed
|
||||||
|
m_ses.m_alerts.post_alert(read_piece_alert(
|
||||||
|
get_handle(), i->piece, error_code(boost::system::errc::operation_canceled, get_system_category())));
|
||||||
|
}
|
||||||
|
if (has_picker()) m_picker->set_piece_priority(i->piece, 1);
|
||||||
|
i = m_time_critical_pieces.erase(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove time critical pieces where priority is 0
|
// remove time critical pieces where priority is 0
|
||||||
void torrent::remove_time_critical_pieces(std::vector<int> const& priority)
|
void torrent::remove_time_critical_pieces(std::vector<int> const& priority)
|
||||||
{
|
{
|
||||||
|
|
|
@ -889,6 +889,11 @@ namespace libtorrent
|
||||||
TORRENT_ASYNC_CALL1(reset_piece_deadline, index);
|
TORRENT_ASYNC_CALL1(reset_piece_deadline, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrent_handle::clear_piece_deadlines() const
|
||||||
|
{
|
||||||
|
TORRENT_ASYNC_CALL(clear_time_critical);
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<torrent> torrent_handle::native_handle() const
|
boost::shared_ptr<torrent> torrent_handle::native_handle() const
|
||||||
{
|
{
|
||||||
return m_torrent.lock();
|
return m_torrent.lock();
|
||||||
|
|
Loading…
Reference in New Issue