forked from premiere/premiere-libtorrent
add option to disable streaming functionality
This commit is contained in:
parent
3b6ab35ae5
commit
827d852c58
|
@ -599,6 +599,8 @@ target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME loggin
|
||||||
DESCRIPTION "build with logging" DISABLED TORRENT_DISABLE_LOGGING)
|
DESCRIPTION "build with logging" DISABLED TORRENT_DISABLE_LOGGING)
|
||||||
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME mutable-torrents DEFAULT ON
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME mutable-torrents DEFAULT ON
|
||||||
DESCRIPTION "Enables mutable torrent support" DISABLED TORRENT_DISABLE_MUTABLE_TORRENTS)
|
DESCRIPTION "Enables mutable torrent support" DISABLED TORRENT_DISABLE_MUTABLE_TORRENTS)
|
||||||
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME streaming DEFAULT ON
|
||||||
|
DESCRIPTION "Enables support for piece deadline" DISABLED TORRENT_DISABLE_STREAMING)
|
||||||
|
|
||||||
find_public_dependency(Iconv)
|
find_public_dependency(Iconv)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
* add build option to disable streaming
|
||||||
|
|
||||||
1.2.5 release
|
1.2.5 release
|
||||||
|
|
||||||
* announce port=1 instead of port=0, when there is no listen port
|
* announce port=1 instead of port=0, when there is no listen port
|
||||||
|
|
3
Jamfile
3
Jamfile
|
@ -435,6 +435,9 @@ feature.compose <sanitize>rtc : <cflags>/RTCc <cflags>/RTCsu ;
|
||||||
feature test-coverage : off on : composite propagated link-incompatible ;
|
feature test-coverage : off on : composite propagated link-incompatible ;
|
||||||
feature.compose <test-coverage>on : <cflags>--coverage <linkflags>--coverage ;
|
feature.compose <test-coverage>on : <cflags>--coverage <linkflags>--coverage ;
|
||||||
|
|
||||||
|
feature streaming : on off : composite propagated ;
|
||||||
|
feature.compose <streaming>off : <define>TORRENT_DISABLE_STREAMING ;
|
||||||
|
|
||||||
feature i2p : on off : composite propagated ;
|
feature i2p : on off : composite propagated ;
|
||||||
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
|
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
|
||||||
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
|
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
|
||||||
|
|
|
@ -530,6 +530,9 @@ defines you can use to control the build.
|
||||||
+----------------------------------------+-------------------------------------------------+
|
+----------------------------------------+-------------------------------------------------+
|
||||||
| ``TORRENT_DISABLE_MUTABLE_TORRENTS`` | Disables mutable torrent support (`BEP 38`_) |
|
| ``TORRENT_DISABLE_MUTABLE_TORRENTS`` | Disables mutable torrent support (`BEP 38`_) |
|
||||||
+----------------------------------------+-------------------------------------------------+
|
+----------------------------------------+-------------------------------------------------+
|
||||||
|
| ``TORRENT_DISABLE_STREAMING`` | Disables set_piece_deadline() and associated |
|
||||||
|
| | functionality. |
|
||||||
|
+----------------------------------------+-------------------------------------------------+
|
||||||
| ``TORRENT_LINKING_SHARED`` | If this is defined when including the |
|
| ``TORRENT_LINKING_SHARED`` | If this is defined when including the |
|
||||||
| | libtorrent headers, the classes and functions |
|
| | libtorrent headers, the classes and functions |
|
||||||
| | will be tagged with ``__declspec(dllimport)`` |
|
| | will be tagged with ``__declspec(dllimport)`` |
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT std::int64_t calc_bytes(file_storage const& fs, piece_count const& pc);
|
TORRENT_EXTRA_EXPORT std::int64_t calc_bytes(file_storage const& fs, piece_count const& pc);
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
struct time_critical_piece
|
struct time_critical_piece
|
||||||
{
|
{
|
||||||
// when this piece was first requested
|
// when this piece was first requested
|
||||||
|
@ -137,6 +138,7 @@ namespace libtorrent {
|
||||||
bool operator<(time_critical_piece const& rhs) const
|
bool operator<(time_critical_piece const& rhs) const
|
||||||
{ return deadline < rhs.deadline; }
|
{ return deadline < rhs.deadline; }
|
||||||
};
|
};
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
// this is the internal representation of web seeds
|
// this is the internal representation of web seeds
|
||||||
struct web_seed_t : web_seed_entry
|
struct web_seed_t : web_seed_entry
|
||||||
|
@ -579,10 +581,13 @@ namespace libtorrent {
|
||||||
void prioritize_files(aux::vector<download_priority_t, file_index_t> files);
|
void prioritize_files(aux::vector<download_priority_t, file_index_t> files);
|
||||||
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
void cancel_non_critical();
|
void cancel_non_critical();
|
||||||
void set_piece_deadline(piece_index_t piece, int t, deadline_flags_t flags);
|
void set_piece_deadline(piece_index_t piece, int t, deadline_flags_t flags);
|
||||||
void reset_piece_deadline(piece_index_t piece);
|
void reset_piece_deadline(piece_index_t piece);
|
||||||
void clear_time_critical();
|
void clear_time_critical();
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
void update_piece_priorities(
|
void update_piece_priorities(
|
||||||
aux::vector<download_priority_t, file_index_t> const& file_prios);
|
aux::vector<download_priority_t, file_index_t> const& file_prios);
|
||||||
|
|
||||||
|
@ -1154,7 +1159,13 @@ namespace libtorrent {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int num_time_critical_pieces() const
|
int num_time_critical_pieces() const
|
||||||
{ return int(m_time_critical_pieces.size()); }
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
|
return int(m_time_critical_pieces.size());
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int get_suggest_pieces(std::vector<piece_index_t>& p
|
int get_suggest_pieces(std::vector<piece_index_t>& p
|
||||||
, typed_bitfield<piece_index_t> const& bits
|
, typed_bitfield<piece_index_t> const& bits
|
||||||
|
@ -1219,9 +1230,11 @@ namespace libtorrent {
|
||||||
bool should_announce_dht() const;
|
bool should_announce_dht() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
void remove_time_critical_piece(piece_index_t piece, bool finished = false);
|
void remove_time_critical_piece(piece_index_t piece, bool finished = false);
|
||||||
void remove_time_critical_pieces(aux::vector<download_priority_t, piece_index_t> const& priority);
|
void remove_time_critical_pieces(aux::vector<download_priority_t, piece_index_t> const& priority);
|
||||||
void request_time_critical_pieces();
|
void request_time_critical_pieces();
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
void need_peer_list();
|
void need_peer_list();
|
||||||
|
|
||||||
|
@ -1293,8 +1306,10 @@ namespace libtorrent {
|
||||||
|
|
||||||
aux::vector<announce_entry> m_trackers;
|
aux::vector<announce_entry> m_trackers;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
// this list is sorted by time_critical_piece::deadline
|
// this list is sorted by time_critical_piece::deadline
|
||||||
std::vector<time_critical_piece> m_time_critical_pieces;
|
std::vector<time_critical_piece> m_time_critical_pieces;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string m_trackerid;
|
std::string m_trackerid;
|
||||||
#if TORRENT_ABI_VERSION == 1
|
#if TORRENT_ABI_VERSION == 1
|
||||||
|
|
|
@ -3933,7 +3933,9 @@ bool is_downloading_state(int const st)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
remove_time_critical_piece(index, true);
|
remove_time_critical_piece(index, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (is_downloading_state(m_state))
|
if (is_downloading_state(m_state))
|
||||||
{
|
{
|
||||||
|
@ -3982,7 +3984,9 @@ bool is_downloading_state(int const st)
|
||||||
|
|
||||||
inc_stats_counter(counters::num_piece_passed);
|
inc_stats_counter(counters::num_piece_passed);
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
remove_time_critical_piece(index, true);
|
remove_time_critical_piece(index, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (settings().get_int(settings_pack::suggest_mode)
|
if (settings().get_int(settings_pack::suggest_mode)
|
||||||
== settings_pack::suggest_read_cache)
|
== settings_pack::suggest_read_cache)
|
||||||
|
@ -4607,6 +4611,7 @@ bool is_downloading_state(int const st)
|
||||||
return detail::read_uint32(ptr);
|
return detail::read_uint32(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
void torrent::cancel_non_critical()
|
void torrent::cancel_non_critical()
|
||||||
{
|
{
|
||||||
std::set<piece_index_t> time_critical;
|
std::set<piece_index_t> time_critical;
|
||||||
|
@ -4834,6 +4839,7 @@ bool is_downloading_state(int const st)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
void torrent::piece_availability(aux::vector<int, piece_index_t>& avail) const
|
void torrent::piece_availability(aux::vector<int, piece_index_t>& avail) const
|
||||||
{
|
{
|
||||||
|
@ -4880,7 +4886,9 @@ bool is_downloading_state(int const st)
|
||||||
if (filter_updated)
|
if (filter_updated)
|
||||||
{
|
{
|
||||||
update_peer_interest(was_finished);
|
update_peer_interest(was_finished);
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
if (priority == dont_download) remove_time_critical_piece(index);
|
if (priority == dont_download) remove_time_critical_piece(index);
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4984,7 +4992,9 @@ bool is_downloading_state(int const st)
|
||||||
set_need_save_resume();
|
set_need_save_resume();
|
||||||
|
|
||||||
update_peer_interest(was_finished);
|
update_peer_interest(was_finished);
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
remove_time_critical_pieces(pieces);
|
remove_time_critical_pieces(pieces);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
state_updated();
|
state_updated();
|
||||||
|
@ -7831,11 +7841,13 @@ bool is_downloading_state(int const st)
|
||||||
TORRENT_ASSERT(m_sequence_number == no_pos
|
TORRENT_ASSERT(m_sequence_number == no_pos
|
||||||
|| m_ses.verify_queue_position(this, m_sequence_number));
|
|| m_ses.verify_queue_position(this, m_sequence_number));
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
for (auto const& i : m_time_critical_pieces)
|
for (auto const& i : m_time_critical_pieces)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(!is_seed());
|
TORRENT_ASSERT(!is_seed());
|
||||||
TORRENT_ASSERT(!has_picker() || !m_picker->have_piece(i.piece));
|
TORRENT_ASSERT(!has_picker() || !m_picker->have_piece(i.piece));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (current_stats_state())
|
switch (current_stats_state())
|
||||||
{
|
{
|
||||||
|
@ -9137,6 +9149,7 @@ bool is_downloading_state(int const st)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
// ---- TIME CRITICAL PIECES ----
|
// ---- TIME CRITICAL PIECES ----
|
||||||
|
|
||||||
#if TORRENT_DEBUG_STREAMING > 0
|
#if TORRENT_DEBUG_STREAMING > 0
|
||||||
|
@ -9166,6 +9179,7 @@ bool is_downloading_state(int const st)
|
||||||
{
|
{
|
||||||
request_time_critical_pieces();
|
request_time_critical_pieces();
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
// ---- WEB SEEDS ----
|
// ---- WEB SEEDS ----
|
||||||
|
|
||||||
|
@ -9463,6 +9477,8 @@ bool is_downloading_state(int const st)
|
||||||
m_ses.received_synack(ipv6);
|
m_ses.received_synack(ipv6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
#if TORRENT_DEBUG_STREAMING > 0
|
#if TORRENT_DEBUG_STREAMING > 0
|
||||||
char const* esc(char const* code)
|
char const* esc(char const* code)
|
||||||
{
|
{
|
||||||
|
@ -9990,6 +10006,7 @@ bool is_downloading_state(int const st)
|
||||||
p->send_block_requests();
|
p->send_block_requests();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_STREAMING
|
||||||
|
|
||||||
std::set<std::string> torrent::web_seeds(web_seed_entry::type_t const type) const
|
std::set<std::string> torrent::web_seeds(web_seed_entry::type_t const type) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -801,17 +801,29 @@ namespace libtorrent {
|
||||||
void torrent_handle::set_piece_deadline(piece_index_t index, int deadline
|
void torrent_handle::set_piece_deadline(piece_index_t index, int deadline
|
||||||
, deadline_flags_t const flags) const
|
, deadline_flags_t const flags) const
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
async_call(&torrent::set_piece_deadline, index, deadline, flags);
|
async_call(&torrent::set_piece_deadline, index, deadline, flags);
|
||||||
|
#else
|
||||||
|
TORRENT_UNUSED(deadline);
|
||||||
|
if (flags & alert_when_available)
|
||||||
|
async_call(&torrent::read_piece, index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent_handle::reset_piece_deadline(piece_index_t index) const
|
void torrent_handle::reset_piece_deadline(piece_index_t index) const
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
async_call(&torrent::reset_piece_deadline, index);
|
async_call(&torrent::reset_piece_deadline, index);
|
||||||
|
#else
|
||||||
|
TORRENT_UNUSED(index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent_handle::clear_piece_deadlines() const
|
void torrent_handle::clear_piece_deadlines() const
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_STREAMING
|
||||||
async_call(&torrent::clear_time_critical);
|
async_call(&torrent::clear_time_critical);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<torrent> torrent_handle::native_handle() const
|
std::shared_ptr<torrent> torrent_handle::native_handle() const
|
||||||
|
|
Loading…
Reference in New Issue