forked from premiere/premiere-libtorrent
added reset_piece_deadline function
This commit is contained in:
parent
d37e617f06
commit
109e527568
|
@ -88,6 +88,7 @@
|
|||
incoming connection
|
||||
* added more detailed instrumentation of the disk I/O thread
|
||||
|
||||
* add reset_piece_deadline function
|
||||
* fix merkle tree torrent assert
|
||||
|
||||
0.15.67 release
|
||||
|
|
|
@ -329,6 +329,7 @@ void bind_torrent_handle()
|
|||
.def("read_piece", _(&torrent_handle::read_piece))
|
||||
.def("set_piece_deadline", _(&torrent_handle::set_piece_deadline)
|
||||
, (arg("index"), arg("deadline"), arg("flags") = 0))
|
||||
.def("reset_piece_deadline", _(&torrent_handle::reset_piece_deadline), (arg("index"))
|
||||
.def("piece_availability", &piece_availability)
|
||||
.def("piece_priority", _(piece_priority0))
|
||||
.def("piece_priority", _(piece_priority1))
|
||||
|
|
|
@ -2274,6 +2274,7 @@ Its declaration looks like this::
|
|||
|
||||
enum deadline_flags { alert_when_available = 1 };
|
||||
void set_piece_deadline(int index, int deadline, int flags = 0) const;
|
||||
void reset_piece_deadline(int index) const;
|
||||
|
||||
void piece_availability(std::vector<int>& avail) const;
|
||||
void piece_priority(int index, int priority) const;
|
||||
|
@ -2322,13 +2323,14 @@ it will throw ``invalid_handle``.
|
|||
Since the torrents are processed by a background thread, there is no
|
||||
guarantee that a handle will remain valid between two calls.
|
||||
|
||||
set_piece_deadline()
|
||||
--------------------
|
||||
set_piece_deadline() reset_piece_deadline()
|
||||
-------------------------------------------
|
||||
|
||||
::
|
||||
|
||||
enum deadline_flags { alert_when_available = 1 };
|
||||
void set_piece_deadline(int index, int deadline, int flags = 0) const;
|
||||
void reset_piece_deadline(int index) const;
|
||||
|
||||
This function sets or resets the deadline associated with a specific piece
|
||||
index (``index``). libtorrent will attempt to download this entire piece before
|
||||
|
@ -2347,6 +2349,8 @@ as calling `read_piece()`_ for ``index``.
|
|||
|
||||
``deadline`` is the number of milliseconds until this piece should be completed.
|
||||
|
||||
``reset_piece_deadline`` removes the deadline from the piece. If it hasn't already
|
||||
been downloaded, it will no longer be considered a priority.
|
||||
|
||||
piece_availability()
|
||||
--------------------
|
||||
|
|
|
@ -298,6 +298,7 @@ namespace libtorrent
|
|||
void file_priorities(std::vector<int>*) const;
|
||||
|
||||
void set_piece_deadline(int piece, int t, int flags);
|
||||
void reset_piece_deadline(int piece);
|
||||
void update_piece_priorities();
|
||||
|
||||
void status(torrent_status* st, boost::uint32_t flags);
|
||||
|
|
|
@ -179,6 +179,7 @@ namespace libtorrent
|
|||
|
||||
enum deadline_flags { alert_when_available = 1 };
|
||||
void set_piece_deadline(int index, int deadline, int flags = 0) const;
|
||||
void reset_piece_deadline(int index) const;
|
||||
|
||||
void set_priority(int prio) const;
|
||||
|
||||
|
|
|
@ -3299,6 +3299,11 @@ namespace libtorrent
|
|||
m_time_critical_pieces.insert(i, p);
|
||||
}
|
||||
|
||||
void torrent::reset_piece_deadline(int piece)
|
||||
{
|
||||
remove_time_critical_piece(piece);
|
||||
}
|
||||
|
||||
void torrent::remove_time_critical_piece(int piece, bool finished)
|
||||
{
|
||||
for (std::list<time_critical_piece>::iterator i = m_time_critical_pieces.begin()
|
||||
|
|
|
@ -869,5 +869,11 @@ namespace libtorrent
|
|||
TORRENT_ASYNC_CALL3(set_piece_deadline, index, deadline, flags);
|
||||
}
|
||||
|
||||
void torrent_handle::reset_piece_deadline(int index) const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
TORRENT_ASYNC_CALL1(reset_piece_deadline, index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue