forked from premiere/premiere-libtorrent
modernize use override (#895)
This commit is contained in:
parent
770935cd46
commit
e782783814
|
@ -54,22 +54,22 @@ using namespace std::placeholders;
|
||||||
|
|
||||||
struct obs : dht::dht_observer
|
struct obs : dht::dht_observer
|
||||||
{
|
{
|
||||||
virtual void set_external_address(address const& /* addr */
|
void set_external_address(address const& /* addr */
|
||||||
, address const& /* source */) override
|
, address const& /* source */) override
|
||||||
{}
|
{}
|
||||||
virtual address external_address(udp proto) override
|
address external_address(udp proto) override
|
||||||
{
|
{
|
||||||
if (proto == udp::v4())
|
if (proto == udp::v4())
|
||||||
return address_v4::from_string("40.30.20.10");
|
return address_v4::from_string("40.30.20.10");
|
||||||
else
|
else
|
||||||
return address_v6();
|
return address_v6();
|
||||||
}
|
}
|
||||||
virtual void get_peers(sha1_hash const&) override {}
|
void get_peers(sha1_hash const&) override {}
|
||||||
virtual void outgoing_get_peers(sha1_hash const& /* target */
|
void outgoing_get_peers(sha1_hash const& /* target */
|
||||||
, sha1_hash const& /* sent_target */, udp::endpoint const& /* ep */) override {}
|
, sha1_hash const& /* sent_target */, udp::endpoint const& /* ep */) override {}
|
||||||
virtual void announce(sha1_hash const& /* ih */
|
void announce(sha1_hash const& /* ih */
|
||||||
, address const& /* addr */, int /* port */) override {}
|
, address const& /* addr */, int /* port */) override {}
|
||||||
virtual void log(dht_logger::module_t l, char const* fmt, ...) override
|
void log(dht_logger::module_t l, char const* fmt, ...) override
|
||||||
{
|
{
|
||||||
va_list v;
|
va_list v;
|
||||||
va_start(v, fmt);
|
va_start(v, fmt);
|
||||||
|
@ -77,10 +77,10 @@ struct obs : dht::dht_observer
|
||||||
va_end(v);
|
va_end(v);
|
||||||
puts("\n");
|
puts("\n");
|
||||||
}
|
}
|
||||||
virtual void log_packet(message_direction_t /* dir */
|
void log_packet(message_direction_t /* dir */
|
||||||
, char const* /* pkt */, int /* len */
|
, char const* /* pkt */, int /* len */
|
||||||
, udp::endpoint /* node */) override {}
|
, udp::endpoint /* node */) override {}
|
||||||
virtual bool on_dht_request(char const* /* query */, int /* query_len */
|
bool on_dht_request(char const* /* query */, int /* query_len */
|
||||||
, dht::msg const& /* request */, entry& /* response */) override
|
, dht::msg const& /* request */, entry& /* response */) override
|
||||||
{ return false; }
|
{ return false; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct sim_config : sim::default_config
|
||||||
asio::ip::address const& requestor
|
asio::ip::address const& requestor
|
||||||
, std::string hostname
|
, std::string hostname
|
||||||
, std::vector<asio::ip::address>& result
|
, std::vector<asio::ip::address>& result
|
||||||
, boost::system::error_code& ec)
|
, boost::system::error_code& ec) override
|
||||||
{
|
{
|
||||||
if (hostname == "try-next.com")
|
if (hostname == "try-next.com")
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,8 +41,8 @@ struct test_threads : lt::pool_thread_interface
|
||||||
{
|
{
|
||||||
test_threads() {}
|
test_threads() {}
|
||||||
|
|
||||||
virtual void notify_all() override { m_cond.notify_all(); }
|
void notify_all() override { m_cond.notify_all(); }
|
||||||
virtual void thread_fun(lt::io_service::work w) override
|
void thread_fun(lt::io_service::work w) override
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_mutex);
|
std::unique_lock<std::mutex> l(m_mutex);
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|
|
@ -247,7 +247,7 @@ struct sim_config : sim::default_config
|
||||||
asio::ip::address const& requestor
|
asio::ip::address const& requestor
|
||||||
, std::string hostname
|
, std::string hostname
|
||||||
, std::vector<asio::ip::address>& result
|
, std::vector<asio::ip::address>& result
|
||||||
, boost::system::error_code& ec)
|
, boost::system::error_code& ec) override
|
||||||
{
|
{
|
||||||
if (hostname == "tracker.com")
|
if (hostname == "tracker.com")
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,10 +165,10 @@ namespace libtorrent
|
||||||
|
|
||||||
struct bdecode_error_category : boost::system::error_category
|
struct bdecode_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual boost::system::error_condition default_error_condition(
|
boost::system::error_condition default_error_condition(
|
||||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
struct libtorrent_error_category : boost::system::error_category
|
struct libtorrent_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -281,9 +281,9 @@ namespace libtorrent
|
||||||
|
|
||||||
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return "http error"; }
|
{ return "http error"; }
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret += to_string(ev).data();
|
ret += to_string(ev).data();
|
||||||
|
@ -311,8 +311,8 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual boost::system::error_condition default_error_condition(
|
boost::system::error_condition default_error_condition(
|
||||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
struct gzip_error_category : boost::system::error_category
|
struct gzip_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override;
|
||||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ namespace libtorrent
|
||||||
|
|
||||||
struct i2p_error_category : boost::system::error_category
|
struct i2p_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return "i2p error"; }
|
{ return "i2p error"; }
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
static char const* messages[] =
|
static char const* messages[] =
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,8 @@ namespace libtorrent
|
||||||
if (ev < 0 || ev >= i2p_error::num_errors) return "unknown error";
|
if (ev < 0 || ev >= i2p_error::num_errors) return "unknown error";
|
||||||
return messages[ev];
|
return messages[ev];
|
||||||
}
|
}
|
||||||
virtual boost::system::error_condition default_error_condition(
|
boost::system::error_condition default_error_condition(
|
||||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace
|
||||||
m_counters.reset();
|
m_counters.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
~dht_default_storage() {}
|
~dht_default_storage() override {}
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
size_t num_torrents() const override { return m_map.size(); }
|
size_t num_torrents() const override { return m_map.size(); }
|
||||||
|
@ -537,7 +537,7 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual dht_storage_counters counters() const override
|
dht_storage_counters counters() const override
|
||||||
{
|
{
|
||||||
return m_counters;
|
return m_counters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,7 +590,7 @@ struct ping_observer : observer
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// parses out "nodes"
|
// parses out "nodes"
|
||||||
virtual void reply(msg const& m)
|
void reply(msg const& m) override
|
||||||
{
|
{
|
||||||
flags |= flag_done;
|
flags |= flag_done;
|
||||||
|
|
||||||
|
|
|
@ -83,10 +83,10 @@ namespace libtorrent { namespace
|
||||||
update_list_hash();
|
update_list_hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual boost::shared_ptr<peer_plugin> new_connection(
|
boost::shared_ptr<peer_plugin> new_connection(
|
||||||
peer_connection_handle const& pc);
|
peer_connection_handle const& pc) override;
|
||||||
|
|
||||||
virtual void tick()
|
void tick() override
|
||||||
{
|
{
|
||||||
if (m_2_minutes++ < 120) return;
|
if (m_2_minutes++ < 120) return;
|
||||||
m_2_minutes = 0;
|
m_2_minutes = 0;
|
||||||
|
@ -159,7 +159,7 @@ namespace libtorrent { namespace
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// can add entries to the extension handshake
|
// can add entries to the extension handshake
|
||||||
virtual void add_handshake(entry& h)
|
void add_handshake(entry& h) override
|
||||||
{
|
{
|
||||||
entry& messages = h["m"];
|
entry& messages = h["m"];
|
||||||
messages["lt_tex"] = 19;
|
messages["lt_tex"] = 19;
|
||||||
|
@ -167,7 +167,7 @@ namespace libtorrent { namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when the extension handshake from the other end is received
|
// called when the extension handshake from the other end is received
|
||||||
virtual bool on_extension_handshake(bdecode_node const& h)
|
bool on_extension_handshake(bdecode_node const& h) override
|
||||||
{
|
{
|
||||||
m_message_index = 0;
|
m_message_index = 0;
|
||||||
if (h.type() != bdecode_node::dict_t) return false;
|
if (h.type() != bdecode_node::dict_t) return false;
|
||||||
|
@ -189,8 +189,8 @@ namespace libtorrent { namespace
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_extended(int /* length */
|
bool on_extended(int /* length */
|
||||||
, int extended_msg, buffer::const_interval body)
|
, int extended_msg, buffer::const_interval body) override
|
||||||
{
|
{
|
||||||
if (extended_msg != 19) return false;
|
if (extended_msg != 19) return false;
|
||||||
if (m_message_index == 0) return false;
|
if (m_message_index == 0) return false;
|
||||||
|
@ -273,7 +273,7 @@ namespace libtorrent { namespace
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void tick()
|
void tick() override
|
||||||
{
|
{
|
||||||
// no handshake yet
|
// no handshake yet
|
||||||
if (!m_message_index) return;
|
if (!m_message_index) return;
|
||||||
|
|
|
@ -111,26 +111,26 @@ namespace libtorrent { namespace
|
||||||
bool need_loaded()
|
bool need_loaded()
|
||||||
{ return m_torrent.need_loaded(); }
|
{ return m_torrent.need_loaded(); }
|
||||||
*/
|
*/
|
||||||
virtual void on_unload() override
|
void on_unload() override
|
||||||
{
|
{
|
||||||
m_metadata.reset();
|
m_metadata.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_load() override
|
void on_load() override
|
||||||
{
|
{
|
||||||
// initialize m_metadata_size
|
// initialize m_metadata_size
|
||||||
TORRENT_ASSERT(m_torrent.is_loaded());
|
TORRENT_ASSERT(m_torrent.is_loaded());
|
||||||
metadata();
|
metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_files_checked() override
|
void on_files_checked() override
|
||||||
{
|
{
|
||||||
// if the torrent is a seed, make a reference to
|
// if the torrent is a seed, make a reference to
|
||||||
// the metadata from the torrent before it is deallocated
|
// the metadata from the torrent before it is deallocated
|
||||||
if (m_torrent.is_seed()) metadata();
|
if (m_torrent.is_seed()) metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual boost::shared_ptr<peer_plugin> new_connection(
|
boost::shared_ptr<peer_plugin> new_connection(
|
||||||
peer_connection_handle const& pc) override;
|
peer_connection_handle const& pc) override;
|
||||||
|
|
||||||
buffer::const_interval metadata() const
|
buffer::const_interval metadata() const
|
||||||
|
@ -271,17 +271,17 @@ namespace libtorrent { namespace
|
||||||
, m_tp(tp)
|
, m_tp(tp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual char const* type() const override { return "LT_metadata"; }
|
char const* type() const override { return "LT_metadata"; }
|
||||||
|
|
||||||
// can add entries to the extension handshake
|
// can add entries to the extension handshake
|
||||||
virtual void add_handshake(entry& h) override
|
void add_handshake(entry& h) override
|
||||||
{
|
{
|
||||||
entry& messages = h["m"];
|
entry& messages = h["m"];
|
||||||
messages["LT_metadata"] = 14;
|
messages["LT_metadata"] = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when the extension handshake from the other end is received
|
// called when the extension handshake from the other end is received
|
||||||
virtual bool on_extension_handshake(bdecode_node const& h) override
|
bool on_extension_handshake(bdecode_node const& h) override
|
||||||
{
|
{
|
||||||
m_message_index = 0;
|
m_message_index = 0;
|
||||||
if (h.type() != bdecode_node::dict_t) return false;
|
if (h.type() != bdecode_node::dict_t) return false;
|
||||||
|
@ -387,7 +387,7 @@ namespace libtorrent { namespace
|
||||||
m_pc.setup_send();
|
m_pc.setup_send();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_extended(int length
|
bool on_extended(int length
|
||||||
, int msg, buffer::const_interval body) override
|
, int msg, buffer::const_interval body) override
|
||||||
{
|
{
|
||||||
if (msg != 14) return false;
|
if (msg != 14) return false;
|
||||||
|
@ -490,7 +490,7 @@ namespace libtorrent { namespace
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void tick() override
|
void tick() override
|
||||||
{
|
{
|
||||||
if (m_pc.is_disconnecting()) return;
|
if (m_pc.is_disconnecting()) return;
|
||||||
|
|
||||||
|
|
|
@ -778,7 +778,7 @@ namespace aux {
|
||||||
{
|
{
|
||||||
session_plugin_wrapper(ext_function_t const& f) : m_f(f) {}
|
session_plugin_wrapper(ext_function_t const& f) : m_f(f) {}
|
||||||
|
|
||||||
virtual boost::shared_ptr<torrent_plugin> new_torrent(torrent_handle const& t, void* user)
|
boost::shared_ptr<torrent_plugin> new_torrent(torrent_handle const& t, void* user) override
|
||||||
{ return m_f(t, user); }
|
{ return m_f(t, user); }
|
||||||
ext_function_t m_f;
|
ext_function_t m_f;
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace
|
||||||
, m_salt(random())
|
, m_salt(random())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void on_piece_pass(int p) override
|
void on_piece_pass(int p) override
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]"
|
m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]"
|
||||||
|
@ -133,7 +133,7 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_piece_failed(int p) override
|
void on_piece_failed(int p) override
|
||||||
{
|
{
|
||||||
// The piece failed the hash check. Record
|
// The piece failed the hash check. Record
|
||||||
// the CRC and origin peer of every block
|
// the CRC and origin peer of every block
|
||||||
|
|
|
@ -51,9 +51,9 @@ namespace libtorrent
|
||||||
|
|
||||||
struct socks_error_category : boost::system::error_category
|
struct socks_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return "socks error"; }
|
{ return "socks error"; }
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
static char const* messages[] =
|
static char const* messages[] =
|
||||||
{
|
{
|
||||||
|
@ -72,8 +72,8 @@ namespace libtorrent
|
||||||
if (ev < 0 || ev >= socks_error::num_errors) return "unknown error";
|
if (ev < 0 || ev >= socks_error::num_errors) return "unknown error";
|
||||||
return messages[ev];
|
return messages[ev];
|
||||||
}
|
}
|
||||||
virtual boost::system::error_condition default_error_condition(
|
boost::system::error_condition default_error_condition(
|
||||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{ return boost::system::error_condition(ev, *this); }
|
{ return boost::system::error_condition(ev, *this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ namespace libtorrent
|
||||||
, std::int64_t const file_offset
|
, std::int64_t const file_offset
|
||||||
, int const size
|
, int const size
|
||||||
, file::iovec_t const* bufs, storage_error& ec)
|
, file::iovec_t const* bufs, storage_error& ec)
|
||||||
override final
|
final
|
||||||
{
|
{
|
||||||
if (m_storage.files().pad_file_at(file_index))
|
if (m_storage.files().pad_file_at(file_index))
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ namespace libtorrent
|
||||||
, std::int64_t const file_offset
|
, std::int64_t const file_offset
|
||||||
, int const size
|
, int const size
|
||||||
, file::iovec_t const* bufs, storage_error& ec)
|
, file::iovec_t const* bufs, storage_error& ec)
|
||||||
override final
|
final
|
||||||
{
|
{
|
||||||
int num_bufs = count_bufs(bufs, size);
|
int num_bufs = count_bufs(bufs, size);
|
||||||
|
|
||||||
|
@ -1365,27 +1365,27 @@ namespace libtorrent
|
||||||
class disabled_storage final : public storage_interface, boost::noncopyable
|
class disabled_storage final : public storage_interface, boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool has_any_file(storage_error&) override { return false; }
|
bool has_any_file(storage_error&) override { return false; }
|
||||||
virtual void set_file_priority(std::vector<std::uint8_t> const&
|
void set_file_priority(std::vector<std::uint8_t> const&
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
virtual void rename_file(int, std::string const&, storage_error&) override {}
|
void rename_file(int, std::string const&, storage_error&) override {}
|
||||||
virtual void release_files(storage_error&) override {}
|
void release_files(storage_error&) override {}
|
||||||
virtual void delete_files(int, storage_error&) override {}
|
void delete_files(int, storage_error&) override {}
|
||||||
virtual void initialize(storage_error&) override {}
|
void initialize(storage_error&) override {}
|
||||||
virtual int move_storage(std::string const&, int, storage_error&) override { return 0; }
|
int move_storage(std::string const&, int, storage_error&) override { return 0; }
|
||||||
|
|
||||||
virtual int readv(file::iovec_t const* bufs, int num_bufs
|
int readv(file::iovec_t const* bufs, int num_bufs
|
||||||
, int, int, int, storage_error&) override
|
, int, int, int, storage_error&) override
|
||||||
{
|
{
|
||||||
return bufs_size(bufs, num_bufs);
|
return bufs_size(bufs, num_bufs);
|
||||||
}
|
}
|
||||||
virtual int writev(file::iovec_t const* bufs, int num_bufs
|
int writev(file::iovec_t const* bufs, int num_bufs
|
||||||
, int, int, int, storage_error&) override
|
, int, int, int, storage_error&) override
|
||||||
{
|
{
|
||||||
return bufs_size(bufs, num_bufs);
|
return bufs_size(bufs, num_bufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool verify_resume_data(add_torrent_params const&
|
bool verify_resume_data(add_torrent_params const&
|
||||||
, std::vector<std::string> const*
|
, std::vector<std::string> const*
|
||||||
, storage_error&) override { return false; }
|
, storage_error&) override { return false; }
|
||||||
};
|
};
|
||||||
|
@ -1405,9 +1405,9 @@ namespace libtorrent
|
||||||
// anything written to it
|
// anything written to it
|
||||||
struct zero_storage final : storage_interface
|
struct zero_storage final : storage_interface
|
||||||
{
|
{
|
||||||
virtual void initialize(storage_error&) override {}
|
void initialize(storage_error&) override {}
|
||||||
|
|
||||||
virtual int readv(file::iovec_t const* bufs, int num_bufs
|
int readv(file::iovec_t const* bufs, int num_bufs
|
||||||
, int, int, int, storage_error&) override
|
, int, int, int, storage_error&) override
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -1418,7 +1418,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual int writev(file::iovec_t const* bufs, int num_bufs
|
int writev(file::iovec_t const* bufs, int num_bufs
|
||||||
, int, int, int, storage_error&) override
|
, int, int, int, storage_error&) override
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -1427,19 +1427,19 @@ namespace libtorrent
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool has_any_file(storage_error&) override { return false; }
|
bool has_any_file(storage_error&) override { return false; }
|
||||||
virtual void set_file_priority(std::vector<std::uint8_t> const& /* prio */
|
void set_file_priority(std::vector<std::uint8_t> const& /* prio */
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
virtual int move_storage(std::string const& /* save_path */
|
int move_storage(std::string const& /* save_path */
|
||||||
, int /* flags */, storage_error&) override { return 0; }
|
, int /* flags */, storage_error&) override { return 0; }
|
||||||
virtual bool verify_resume_data(add_torrent_params const& /* rd */
|
bool verify_resume_data(add_torrent_params const& /* rd */
|
||||||
, std::vector<std::string> const* /* links */
|
, std::vector<std::string> const* /* links */
|
||||||
, storage_error&) override
|
, storage_error&) override
|
||||||
{ return false; }
|
{ return false; }
|
||||||
virtual void release_files(storage_error&) override {}
|
void release_files(storage_error&) override {}
|
||||||
virtual void rename_file(int /* index */
|
void rename_file(int /* index */
|
||||||
, std::string const& /* new_filenamem */, storage_error&) override {}
|
, std::string const& /* new_filenamem */, storage_error&) override {}
|
||||||
virtual void delete_files(int, storage_error&) override {}
|
void delete_files(int, storage_error&) override {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1143,12 +1143,12 @@ namespace
|
||||||
|
|
||||||
struct upnp_error_category : boost::system::error_category
|
struct upnp_error_category : boost::system::error_category
|
||||||
{
|
{
|
||||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
|
const char* name() const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
return "UPnP error";
|
return "UPnP error";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
int num_errors = sizeof(error_codes) / sizeof(error_codes[0]);
|
int num_errors = sizeof(error_codes) / sizeof(error_codes[0]);
|
||||||
error_code_t* end = error_codes + num_errors;
|
error_code_t* end = error_codes + num_errors;
|
||||||
|
@ -1165,8 +1165,8 @@ struct upnp_error_category : boost::system::error_category
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual boost::system::error_condition default_error_condition(
|
boost::system::error_condition default_error_condition(
|
||||||
int ev) const BOOST_SYSTEM_NOEXCEPT
|
int ev) const BOOST_SYSTEM_NOEXCEPT override
|
||||||
{
|
{
|
||||||
return boost::system::error_condition(ev, *this);
|
return boost::system::error_condition(ev, *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,19 +108,19 @@ namespace libtorrent { namespace
|
||||||
bool need_loaded()
|
bool need_loaded()
|
||||||
{ return m_torrent.need_loaded(); }
|
{ return m_torrent.need_loaded(); }
|
||||||
|
|
||||||
virtual void on_unload() override
|
void on_unload() override
|
||||||
{
|
{
|
||||||
m_metadata.reset();
|
m_metadata.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_load() override
|
void on_load() override
|
||||||
{
|
{
|
||||||
// initialize m_metadata_size
|
// initialize m_metadata_size
|
||||||
TORRENT_ASSERT(m_torrent.is_loaded());
|
TORRENT_ASSERT(m_torrent.is_loaded());
|
||||||
metadata();
|
metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_files_checked() override
|
void on_files_checked() override
|
||||||
{
|
{
|
||||||
// TODO: 2 if we were to initialize m_metadata_size lazily instead,
|
// TODO: 2 if we were to initialize m_metadata_size lazily instead,
|
||||||
// we would probably be more efficient
|
// we would probably be more efficient
|
||||||
|
@ -128,7 +128,7 @@ namespace libtorrent { namespace
|
||||||
metadata();
|
metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual boost::shared_ptr<peer_plugin> new_connection(
|
boost::shared_ptr<peer_plugin> new_connection(
|
||||||
peer_connection_handle const& pc) override;
|
peer_connection_handle const& pc) override;
|
||||||
|
|
||||||
int get_metadata_size() const
|
int get_metadata_size() const
|
||||||
|
@ -231,10 +231,10 @@ namespace libtorrent { namespace
|
||||||
, m_tp(tp)
|
, m_tp(tp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual char const* type() const override { return "ut_metadata"; }
|
char const* type() const override { return "ut_metadata"; }
|
||||||
|
|
||||||
// can add entries to the extension handshake
|
// can add entries to the extension handshake
|
||||||
virtual void add_handshake(entry& h) override
|
void add_handshake(entry& h) override
|
||||||
{
|
{
|
||||||
entry& messages = h["m"];
|
entry& messages = h["m"];
|
||||||
messages["ut_metadata"] = 2;
|
messages["ut_metadata"] = 2;
|
||||||
|
@ -243,7 +243,7 @@ namespace libtorrent { namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when the extension handshake from the other end is received
|
// called when the extension handshake from the other end is received
|
||||||
virtual bool on_extension_handshake(bdecode_node const& h) override
|
bool on_extension_handshake(bdecode_node const& h) override
|
||||||
{
|
{
|
||||||
m_message_index = 0;
|
m_message_index = 0;
|
||||||
if (h.type() != bdecode_node::dict_t) return false;
|
if (h.type() != bdecode_node::dict_t) return false;
|
||||||
|
@ -328,7 +328,7 @@ namespace libtorrent { namespace
|
||||||
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_metadata);
|
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_extended(int length
|
bool on_extended(int length
|
||||||
, int extended_msg, buffer::const_interval body) override
|
, int extended_msg, buffer::const_interval body) override
|
||||||
{
|
{
|
||||||
if (extended_msg != 2) return false;
|
if (extended_msg != 2) return false;
|
||||||
|
@ -445,7 +445,7 @@ namespace libtorrent { namespace
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void tick() override
|
void tick() override
|
||||||
{
|
{
|
||||||
maybe_send_request();
|
maybe_send_request();
|
||||||
while (!m_incoming_requests.empty()
|
while (!m_incoming_requests.empty()
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace libtorrent { namespace
|
||||||
, m_last_msg(min_time())
|
, m_last_msg(min_time())
|
||||||
, m_peers_in_message(0) {}
|
, m_peers_in_message(0) {}
|
||||||
|
|
||||||
virtual boost::shared_ptr<peer_plugin> new_connection(
|
boost::shared_ptr<peer_plugin> new_connection(
|
||||||
peer_connection_handle const& pc) override;
|
peer_connection_handle const& pc) override;
|
||||||
|
|
||||||
std::vector<char>& get_ut_pex_msg()
|
std::vector<char>& get_ut_pex_msg()
|
||||||
|
@ -111,7 +111,7 @@ namespace libtorrent { namespace
|
||||||
// are calculated here and the pex message is created
|
// are calculated here and the pex message is created
|
||||||
// each peer connection will use this message
|
// each peer connection will use this message
|
||||||
// max_peer_entries limits the packet size
|
// max_peer_entries limits the packet size
|
||||||
virtual void tick() override
|
void tick() override
|
||||||
{
|
{
|
||||||
time_point now = aux::time_now();
|
time_point now = aux::time_now();
|
||||||
if (now - seconds(60) < m_last_msg) return;
|
if (now - seconds(60) < m_last_msg) return;
|
||||||
|
@ -259,15 +259,15 @@ namespace libtorrent { namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char const* type() const override { return "ut_pex"; }
|
char const* type() const override { return "ut_pex"; }
|
||||||
|
|
||||||
virtual void add_handshake(entry& h) override
|
void add_handshake(entry& h) override
|
||||||
{
|
{
|
||||||
entry& messages = h["m"];
|
entry& messages = h["m"];
|
||||||
messages[extension_name] = extension_index;
|
messages[extension_name] = extension_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_extension_handshake(bdecode_node const& h) override
|
bool on_extension_handshake(bdecode_node const& h) override
|
||||||
{
|
{
|
||||||
m_message_index = 0;
|
m_message_index = 0;
|
||||||
if (h.type() != bdecode_node::dict_t) return false;
|
if (h.type() != bdecode_node::dict_t) return false;
|
||||||
|
@ -280,7 +280,7 @@ namespace libtorrent { namespace
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_extended(int length, int msg, buffer::const_interval body) override
|
bool on_extended(int length, int msg, buffer::const_interval body) override
|
||||||
{
|
{
|
||||||
if (msg != extension_index) return false;
|
if (msg != extension_index) return false;
|
||||||
if (m_message_index == 0) return false;
|
if (m_message_index == 0) return false;
|
||||||
|
@ -433,7 +433,7 @@ namespace libtorrent { namespace
|
||||||
|
|
||||||
// the peers second tick
|
// the peers second tick
|
||||||
// every minute we send a pex message
|
// every minute we send a pex message
|
||||||
virtual void tick() override
|
void tick() override
|
||||||
{
|
{
|
||||||
// no handshake yet
|
// no handshake yet
|
||||||
if (!m_message_index) return;
|
if (!m_message_index) return;
|
||||||
|
|
|
@ -157,7 +157,7 @@ int plugin_alerts[3] = { 0, 0, 0 };
|
||||||
struct test_plugin : libtorrent::plugin
|
struct test_plugin : libtorrent::plugin
|
||||||
{
|
{
|
||||||
test_plugin(int index) : m_index(index) {}
|
test_plugin(int index) : m_index(index) {}
|
||||||
virtual void on_alert(alert const* a)
|
void on_alert(alert const* a) override
|
||||||
{
|
{
|
||||||
++plugin_alerts[m_index];
|
++plugin_alerts[m_index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,9 @@ struct peer_connection: bandwidth_socket, boost::enable_shared_from_this<peer_co
|
||||||
, m_quota(0)
|
, m_quota(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool is_disconnecting() const { return false; }
|
bool is_disconnecting() const override { return false; }
|
||||||
bool ignore_bandwidth_limits() { return m_ignore_limits; }
|
bool ignore_bandwidth_limits() { return m_ignore_limits; }
|
||||||
void assign_bandwidth(int channel, int amount);
|
void assign_bandwidth(int channel, int amount) override;
|
||||||
|
|
||||||
void throttle(int limit) { m_bandwidth_channel.throttle(limit); }
|
void throttle(int limit) { m_bandwidth_channel.throttle(limit); }
|
||||||
|
|
||||||
|
|
|
@ -47,33 +47,33 @@ using namespace libtorrent;
|
||||||
|
|
||||||
struct test_storage_impl : storage_interface
|
struct test_storage_impl : storage_interface
|
||||||
{
|
{
|
||||||
virtual void initialize(storage_error& ec) override {}
|
void initialize(storage_error& ec) override {}
|
||||||
|
|
||||||
virtual int readv(file::iovec_t const* bufs, int num_bufs
|
int readv(file::iovec_t const* bufs, int num_bufs
|
||||||
, int piece, int offset, int flags, storage_error& ec) override
|
, int piece, int offset, int flags, storage_error& ec) override
|
||||||
{
|
{
|
||||||
return bufs_size(bufs, num_bufs);
|
return bufs_size(bufs, num_bufs);
|
||||||
}
|
}
|
||||||
virtual int writev(file::iovec_t const* bufs, int num_bufs
|
int writev(file::iovec_t const* bufs, int num_bufs
|
||||||
, int piece, int offset, int flags, storage_error& ec) override
|
, int piece, int offset, int flags, storage_error& ec) override
|
||||||
{
|
{
|
||||||
return bufs_size(bufs, num_bufs);
|
return bufs_size(bufs, num_bufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool has_any_file(storage_error& ec) override { return false; }
|
bool has_any_file(storage_error& ec) override { return false; }
|
||||||
virtual void set_file_priority(std::vector<std::uint8_t> const& prio
|
void set_file_priority(std::vector<std::uint8_t> const& prio
|
||||||
, storage_error& ec) override {}
|
, storage_error& ec) override {}
|
||||||
virtual int move_storage(std::string const& save_path, int flags
|
int move_storage(std::string const& save_path, int flags
|
||||||
, storage_error& ec) override { return 0; }
|
, storage_error& ec) override { return 0; }
|
||||||
virtual bool verify_resume_data(add_torrent_params const& rd
|
bool verify_resume_data(add_torrent_params const& rd
|
||||||
, std::vector<std::string> const* links
|
, std::vector<std::string> const* links
|
||||||
, storage_error& ec) override { return true; }
|
, storage_error& ec) override { return true; }
|
||||||
virtual void release_files(storage_error& ec) override {}
|
void release_files(storage_error& ec) override {}
|
||||||
virtual void rename_file(int index, std::string const& new_filenamem
|
void rename_file(int index, std::string const& new_filenamem
|
||||||
, storage_error& ec) override {}
|
, storage_error& ec) override {}
|
||||||
virtual void delete_files(int, storage_error& ec) override {}
|
void delete_files(int, storage_error& ec) override {}
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
virtual void finalize_file(int, storage_error&) override {}
|
void finalize_file(int, storage_error&) override {}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -458,20 +458,20 @@ void put_immutable_item_cb(int num, int expect)
|
||||||
|
|
||||||
struct obs : dht::dht_observer
|
struct obs : dht::dht_observer
|
||||||
{
|
{
|
||||||
virtual void set_external_address(address const& addr
|
void set_external_address(address const& addr
|
||||||
, address const& source) override
|
, address const& source) override
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual address external_address(udp proto) override
|
address external_address(udp proto) override
|
||||||
{
|
{
|
||||||
return address_v4::from_string("236.0.0.1");
|
return address_v4::from_string("236.0.0.1");
|
||||||
}
|
}
|
||||||
virtual void get_peers(sha1_hash const& ih) override {}
|
void get_peers(sha1_hash const& ih) override {}
|
||||||
virtual void outgoing_get_peers(sha1_hash const& target
|
void outgoing_get_peers(sha1_hash const& target
|
||||||
, sha1_hash const& sent_target, udp::endpoint const& ep) override {}
|
, sha1_hash const& sent_target, udp::endpoint const& ep) override {}
|
||||||
virtual void announce(sha1_hash const& ih, address const& addr, int port) override {}
|
void announce(sha1_hash const& ih, address const& addr, int port) override {}
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
virtual void log(dht_logger::module_t l, char const* fmt, ...) override
|
void log(dht_logger::module_t l, char const* fmt, ...) override
|
||||||
{
|
{
|
||||||
va_list v;
|
va_list v;
|
||||||
va_start(v, fmt);
|
va_start(v, fmt);
|
||||||
|
@ -480,10 +480,10 @@ struct obs : dht::dht_observer
|
||||||
va_end(v);
|
va_end(v);
|
||||||
m_log.push_back(buf);
|
m_log.push_back(buf);
|
||||||
}
|
}
|
||||||
virtual void log_packet(message_direction_t dir, char const* pkt, int len
|
void log_packet(message_direction_t dir, char const* pkt, int len
|
||||||
, udp::endpoint node) override {}
|
, udp::endpoint node) override {}
|
||||||
#endif
|
#endif
|
||||||
virtual bool on_dht_request(char const* query, int query_len
|
bool on_dht_request(char const* query, int query_len
|
||||||
, dht::msg const& request, entry& response) override { return false; }
|
, dht::msg const& request, entry& response) override { return false; }
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
|
|
@ -47,14 +47,14 @@ namespace
|
||||||
|
|
||||||
struct test_plugin : plugin
|
struct test_plugin : plugin
|
||||||
{
|
{
|
||||||
virtual std::uint32_t implemented_features()
|
std::uint32_t implemented_features() override
|
||||||
{
|
{
|
||||||
return plugin::dht_request_feature;
|
return plugin::dht_request_feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool on_dht_request(char const* /* query */, int const /* query_len */
|
bool on_dht_request(char const* /* query */, int const /* query_len */
|
||||||
, udp::endpoint const& /* source */, bdecode_node const& message
|
, udp::endpoint const& /* source */, bdecode_node const& message
|
||||||
, entry& response)
|
, entry& response) override
|
||||||
{
|
{
|
||||||
if (message.dict_find_string_value("q") == "test_good")
|
if (message.dict_find_string_value("q") == "test_good")
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ using namespace libtorrent;
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
struct log_t : libtorrent::dht::dht_logger
|
struct log_t : libtorrent::dht::dht_logger
|
||||||
{
|
{
|
||||||
virtual void log(dht_logger::module_t m, char const* fmt, ...)
|
void log(dht_logger::module_t m, char const* fmt, ...)
|
||||||
override TORRENT_FORMAT(3, 4)
|
override TORRENT_FORMAT(3, 4)
|
||||||
{
|
{
|
||||||
va_list v;
|
va_list v;
|
||||||
|
@ -54,7 +54,7 @@ struct log_t : libtorrent::dht::dht_logger
|
||||||
va_end(v);
|
va_end(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void log_packet(message_direction_t dir, char const* pkt, int len
|
void log_packet(message_direction_t dir, char const* pkt, int len
|
||||||
, udp::endpoint node) override
|
, udp::endpoint node) override
|
||||||
{
|
{
|
||||||
libtorrent::bdecode_node print;
|
libtorrent::bdecode_node print;
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct B : A
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
explicit B(int a_, int b_) : A(a_), b(b_) {}
|
explicit B(int a_, int b_) : A(a_), b(b_) {}
|
||||||
virtual int type() { return 1; }
|
int type() override { return 1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct C : A
|
struct C : A
|
||||||
|
@ -55,7 +55,7 @@ struct C : A
|
||||||
{
|
{
|
||||||
memset(c, c_, sizeof(c));
|
memset(c, c_, sizeof(c));
|
||||||
}
|
}
|
||||||
virtual int type() { return 2; }
|
int type() override { return 2; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct D
|
struct D
|
||||||
|
|
|
@ -70,7 +70,7 @@ struct mock_peer_connection
|
||||||
virtual ~mock_peer_connection() {}
|
virtual ~mock_peer_connection() {}
|
||||||
|
|
||||||
#if !defined TORRENT_DISABLE_LOGGING
|
#if !defined TORRENT_DISABLE_LOGGING
|
||||||
virtual void peer_log(peer_log_alert::direction_t dir, char const* event
|
void peer_log(peer_log_alert::direction_t dir, char const* event
|
||||||
, char const* fmt, ...) const override
|
, char const* fmt, ...) const override
|
||||||
{
|
{
|
||||||
va_list v;
|
va_list v;
|
||||||
|
@ -93,22 +93,22 @@ struct mock_peer_connection
|
||||||
bool m_disconnect_called;
|
bool m_disconnect_called;
|
||||||
mock_torrent& m_torrent;
|
mock_torrent& m_torrent;
|
||||||
|
|
||||||
virtual void get_peer_info(peer_info& p) const override {}
|
void get_peer_info(peer_info& p) const override {}
|
||||||
virtual tcp::endpoint const& remote() const override { return m_remote; }
|
tcp::endpoint const& remote() const override { return m_remote; }
|
||||||
virtual tcp::endpoint local_endpoint() const override { return m_local; }
|
tcp::endpoint local_endpoint() const override { return m_local; }
|
||||||
virtual void disconnect(error_code const& ec
|
void disconnect(error_code const& ec
|
||||||
, operation_t op, int error = 0) override;
|
, operation_t op, int error = 0) override;
|
||||||
virtual peer_id const& pid() const override { return m_id; }
|
peer_id const& pid() const override { return m_id; }
|
||||||
virtual void set_holepunch_mode() override {}
|
void set_holepunch_mode() override {}
|
||||||
virtual torrent_peer* peer_info_struct() const override { return m_tp; }
|
torrent_peer* peer_info_struct() const override { return m_tp; }
|
||||||
virtual void set_peer_info(torrent_peer* pi) override { m_tp = pi; }
|
void set_peer_info(torrent_peer* pi) override { m_tp = pi; }
|
||||||
virtual bool is_outgoing() const override { return m_outgoing; }
|
bool is_outgoing() const override { return m_outgoing; }
|
||||||
virtual void add_stat(std::int64_t downloaded, std::int64_t uploaded) override
|
void add_stat(std::int64_t downloaded, std::int64_t uploaded) override
|
||||||
{ m_stat.add_stat(downloaded, uploaded); }
|
{ m_stat.add_stat(downloaded, uploaded); }
|
||||||
virtual bool fast_reconnect() const override { return true; }
|
bool fast_reconnect() const override { return true; }
|
||||||
virtual bool is_choked() const override { return m_choked; }
|
bool is_choked() const override { return m_choked; }
|
||||||
virtual bool failed() const override { return false; }
|
bool failed() const override { return false; }
|
||||||
virtual libtorrent::stat const& statistics() const override { return m_stat; }
|
libtorrent::stat const& statistics() const override { return m_stat; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mock_torrent
|
struct mock_torrent
|
||||||
|
|
|
@ -1025,7 +1025,7 @@ struct test_fileop : fileop
|
||||||
test_fileop(int stripe_size) : m_stripe_size(stripe_size) {}
|
test_fileop(int stripe_size) : m_stripe_size(stripe_size) {}
|
||||||
|
|
||||||
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
||||||
, file::iovec_t const* bufs, storage_error& ec)
|
, file::iovec_t const* bufs, storage_error& ec) override
|
||||||
{
|
{
|
||||||
size_t offset = size_t(file_offset);
|
size_t offset = size_t(file_offset);
|
||||||
if (file_index >= int(m_file_data.size()))
|
if (file_index >= int(m_file_data.size()))
|
||||||
|
@ -1064,7 +1064,7 @@ struct test_read_fileop : fileop
|
||||||
test_read_fileop(int size) : m_size(size), m_counter(0) {}
|
test_read_fileop(int size) : m_size(size), m_counter(0) {}
|
||||||
|
|
||||||
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
||||||
, file::iovec_t const* bufs, storage_error& ec)
|
, file::iovec_t const* bufs, storage_error& ec) override
|
||||||
{
|
{
|
||||||
int local_size = (std::min)(m_size, size);
|
int local_size = (std::min)(m_size, size);
|
||||||
const int read = local_size;
|
const int read = local_size;
|
||||||
|
@ -1095,7 +1095,7 @@ struct test_error_fileop : fileop
|
||||||
: m_error_file(error_file) {}
|
: m_error_file(error_file) {}
|
||||||
|
|
||||||
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
int file_op(int const file_index, std::int64_t const file_offset, int const size
|
||||||
, file::iovec_t const* bufs, storage_error& ec)
|
, file::iovec_t const* bufs, storage_error& ec) override
|
||||||
{
|
{
|
||||||
if (m_error_file == file_index)
|
if (m_error_file == file_index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,8 +77,8 @@ struct test_storage : default_storage
|
||||||
, m_limit(16 * 1024 * 2)
|
, m_limit(16 * 1024 * 2)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void set_file_priority(std::vector<std::uint8_t> const& p
|
void set_file_priority(std::vector<std::uint8_t> const& p
|
||||||
, storage_error& ec) {}
|
, storage_error& ec) override {}
|
||||||
|
|
||||||
void set_limit(int lim)
|
void set_limit(int lim)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ struct test_storage : default_storage
|
||||||
, int piece_index
|
, int piece_index
|
||||||
, int offset
|
, int offset
|
||||||
, int flags
|
, int flags
|
||||||
, storage_error& se)
|
, storage_error& se) override
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_mutex);
|
std::unique_lock<std::mutex> l(m_mutex);
|
||||||
if (m_written >= m_limit)
|
if (m_written >= m_limit)
|
||||||
|
@ -110,7 +110,7 @@ struct test_storage : default_storage
|
||||||
return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se);
|
return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~test_storage() {}
|
~test_storage() override {}
|
||||||
|
|
||||||
int m_written;
|
int m_written;
|
||||||
int m_limit;
|
int m_limit;
|
||||||
|
|
Loading…
Reference in New Issue