fix warnings, some clean-up and todo comments

This commit is contained in:
Arvid Norberg 2015-04-20 04:52:49 +00:00
parent 4fd230dbe5
commit 4d15f1410f
22 changed files with 234 additions and 106 deletions

View File

@ -2,8 +2,8 @@
* deprecated RSS API * deprecated RSS API
* experimental support for BEP 38, "mutable torrents" * experimental support for BEP 38, "mutable torrents"
* replaced lazy_bdecode with a new bdecoder that's a lot more efficient * replaced lazy_bdecode with a new bdecoder that's a lot more efficient
* deprecate time functions, expose typedefs of boost::chrono in the libtorrent * deprecate time functions, expose typedefs of boost::chrono in the
namespace instead libtorrent namespace instead
* deprecate file_base feature in file_storage/torrent_info * deprecate file_base feature in file_storage/torrent_info
* improve piece picker support for reverse picking (used for snubbed peers) * improve piece picker support for reverse picking (used for snubbed peers)
to not cause priority inversion for regular peers to not cause priority inversion for regular peers
@ -28,32 +28,43 @@
* support SSL over uTP connections * support SSL over uTP connections
* support web seeds that resolve to multiple IPs * support web seeds that resolve to multiple IPs
* added auto-sequential feature. download well-seeded torrents in-order * added auto-sequential feature. download well-seeded torrents in-order
* removed built-in GeoIP support (this functionality is orthogonal to libtorrent) * removed built-in GeoIP support (this functionality is orthogonal to
libtorrent)
* deprecate proxy settings in favor of regular settings * deprecate proxy settings in favor of regular settings
* deprecate separate settings for peer protocol encryption * deprecate separate settings for peer protocol encryption
* support specifying listen interfaces and outgoing interfaces as device * support specifying listen interfaces and outgoing interfaces as device
names (eth0, en2, tun0 etc.) names (eth0, en2, tun0 etc.)
* support for using purgrable memory as disk cache on Mac OS. * support for using purgrable memory as disk cache on Mac OS.
* be more aggressive in corking sockets, to coalesce messages into larger packets. * be more aggressive in corking sockets, to coalesce messages into larger
packets.
* pre-emptively unchoke peers to save one round-trip at connection start-up. * pre-emptively unchoke peers to save one round-trip at connection start-up.
* add session constructor overload that takes a settings_pack * add session constructor overload that takes a settings_pack
* torrent_info is no longer an intrusive_ptr type. It is held by shared_ptr. This is a non-backwards compatible change * torrent_info is no longer an intrusive_ptr type. It is held by shared_ptr.
This is a non-backwards compatible change
* move listen interface and port to the settings * move listen interface and port to the settings
* move use_interfaces() to be a setting * move use_interfaces() to be a setting
* extend storage interface to allow deferred flushing and flush the part-file metadata periodically * extend storage interface to allow deferred flushing and flush the part-file
metadata periodically
* make statistics propagate instantly rather than on the second tick * make statistics propagate instantly rather than on the second tick
* support for partfiles, where partial pieces belonging to skipped files are put * support for partfiles, where partial pieces belonging to skipped files are
* support using multiple threads for socket operations (especially useful for high performance SSL connections) put
* allow setting rate limits for arbitrary peer groups. Generalizes per-torrent rate limits, and local peer limits * support using multiple threads for socket operations (especially useful for
high performance SSL connections)
* allow setting rate limits for arbitrary peer groups. Generalizes
per-torrent rate limits, and local peer limits
* improved disk cache complexity O(1) instead of O(log(n)) * improved disk cache complexity O(1) instead of O(log(n))
* add feature to allow storing disk cache blocks in an mmapped file (presumably on an SSD) * add feature to allow storing disk cache blocks in an mmapped file
* optimize peer connection distribution logic across torrents to scale better with many torrents (presumably on an SSD)
* replaced std::map with boost::unordered_map for torrent list, to scale better with many torrents * optimize peer connection distribution logic across torrents to scale
better with many torrents
* replaced std::map with boost::unordered_map for torrent list, to scale
better with many torrents
* optimized piece picker * optimized piece picker
* optimized disk cache * optimized disk cache
* optimized .torrent file parsing * optimized .torrent file parsing
* optimized initialization of storage when adding a torrent * optimized initialization of storage when adding a torrent
* added support for adding torrents asynchronously (for improved startup performance) * added support for adding torrents asynchronously (for improved startup
performance)
* added support for asynchronous disk I/O * added support for asynchronous disk I/O
* almost completely changed the storage interface (for custom storage) * almost completely changed the storage interface (for custom storage)
* added support for hashing pieces in multiple threads * added support for hashing pieces in multiple threads

View File

@ -240,7 +240,11 @@ rule warnings ( properties * )
result += <cflags>-Wno-exit-time-destructors ; result += <cflags>-Wno-exit-time-destructors ;
result += <cflags>-Wno-documentation-unknown-command ; result += <cflags>-Wno-documentation-unknown-command ;
result += <cflags>-Wno-disabled-macro-expansion ; result += <cflags>-Wno-disabled-macro-expansion ;
# enable these warnings again, once the other ones are dealt with
result += <cflags>-Wno-weak-vtables ; result += <cflags>-Wno-weak-vtables ;
result += <cflags>-Wno-sign-compare ;
result += <cflags>-Wno-sign-conversion ;
} }
if <toolset>gcc in $(properties) if <toolset>gcc in $(properties)

View File

@ -97,6 +97,8 @@ namespace libtorrent
static char const* job_names[7]; static char const* job_names[7];
}; };
// TODO: 3 this is defined in disk_io_thread.cpp. The implementation should
// be moved out to a separate file and declared in its header
char const* job_name(int j); char const* job_name(int j);
void print_piece_log(std::vector<piece_log_t> const& piece_log); void print_piece_log(std::vector<piece_log_t> const& piece_log);

View File

@ -554,6 +554,7 @@ namespace libtorrent
storage_error(error_code e): ec(e), file(-1), operation(0) {} storage_error(error_code e): ec(e), file(-1), operation(0) {}
operator bool() const { return ec.value() != 0; } operator bool() const { return ec.value() != 0; }
// the error that occurred // the error that occurred
error_code ec; error_code ec;

View File

@ -153,7 +153,7 @@ namespace libtorrent
{ {
std::memcpy(reinterpret_cast<void*>(start), str.c_str(), str.size()); std::memcpy(reinterpret_cast<void*>(start), str.c_str(), str.size());
start += str.size(); start += str.size();
return str.size(); return int(str.size());
} }
template <class OutIt> template <class OutIt>

View File

@ -102,6 +102,8 @@ struct key_desc_t
bool TORRENT_EXTRA_EXPORT verify_message(bdecode_node const& msg, key_desc_t const desc[] bool TORRENT_EXTRA_EXPORT verify_message(bdecode_node const& msg, key_desc_t const desc[]
, bdecode_node ret[], int size , char* error, int error_size); , bdecode_node ret[], int size , char* error, int error_size);
void incoming_error(entry& e, char const* msg, int error_code = 203);
// this is the entry for every peer // this is the entry for every peer
// the timestamp is there to make it possible // the timestamp is there to make it possible
// to remove stale peers // to remove stale peers

View File

@ -50,7 +50,7 @@ struct sliding_average
{ {
// fixed point // fixed point
s *= 64; s *= 64;
int deviation; int deviation = 0;
if (m_num_samples > 0) if (m_num_samples > 0)
deviation = std::abs(m_mean - s); deviation = std::abs(m_mean - s);

View File

@ -315,7 +315,8 @@ namespace libtorrent
>::value >::value
}; };
boost::int64_t m_data[(storage_size + sizeof(boost::int64_t) - 1) / sizeof(boost::int64_t)]; boost::int64_t m_data[(storage_size + sizeof(boost::int64_t) - 1)
/ sizeof(boost::int64_t)];
}; };
// returns true if this socket is an SSL socket // returns true if this socket is an SSL socket

View File

@ -456,8 +456,6 @@ namespace libtorrent
// this is used to open the file, but also passed along as the // this is used to open the file, but also passed along as the
// flags argument to the file operation (readv or writev) // flags argument to the file operation (readv or writev)
int mode; int mode;
// used for error reporting
int operation_type;
}; };
void delete_one_file(std::string const& p, error_code& ec); void delete_one_file(std::string const& p, error_code& ec);

View File

@ -3260,6 +3260,7 @@ namespace libtorrent
std::copy(recv_buffer.begin + 8, recv_buffer.begin + 28 std::copy(recv_buffer.begin + 8, recv_buffer.begin + 28
, (char*)info_hash.begin()); , (char*)info_hash.begin());
// TODO: 3 remove the allow_encrypted parameter
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
bool allow_encrypted = m_encrypted && m_rc4_encrypted; bool allow_encrypted = m_encrypted && m_rc4_encrypted;
#else #else

View File

@ -54,7 +54,7 @@ namespace libtorrent
class alert; class alert;
namespace detail namespace
{ {
inline bool default_pred(std::string const&) { return true; } inline bool default_pred(std::string const&) { return true; }
@ -157,7 +157,38 @@ namespace libtorrent
} }
} }
} }
} // detail namespace
void on_hash(disk_io_job const* j, create_torrent* t
, boost::shared_ptr<piece_manager> storage, disk_io_thread* iothread
, int* piece_counter, int* completed_piece
, boost::function<void(int)> const* f, error_code* ec)
{
if (j->ret != 0)
{
// on error
*ec = j->error.ec;
iothread->set_num_threads(0);
return;
}
t->set_hash(j->piece, sha1_hash(j->d.piece_hash));
(*f)(*completed_piece);
++(*completed_piece);
if (*piece_counter < t->num_pieces())
{
iothread->async_hash(storage.get(), *piece_counter
, disk_io_job::sequential_access
, boost::bind(&on_hash, _1, t, storage, iothread
, piece_counter, completed_piece, f, ec), (void*)0);
++(*piece_counter);
}
else
{
iothread->set_num_threads(0);
}
iothread->submit_jobs();
}
} // anonymous namespace
#if TORRENT_USE_WSTRING #if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
@ -167,7 +198,7 @@ namespace libtorrent
{ {
std::string utf8; std::string utf8;
wchar_utf8(wfile, utf8); wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8)) add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), p, flags); , filename(utf8), p, flags);
} }
@ -176,8 +207,8 @@ namespace libtorrent
{ {
std::string utf8; std::string utf8;
wchar_utf8(wfile, utf8); wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8)) add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), detail::default_pred, flags); , filename(utf8), default_pred, flags);
} }
void set_piece_hashes(create_torrent& t, std::wstring const& p void set_piece_hashes(create_torrent& t, std::wstring const& p
@ -193,42 +224,13 @@ namespace libtorrent
void add_files(file_storage& fs, std::string const& file void add_files(file_storage& fs, std::string const& file
, boost::function<bool(std::string)> p, boost::uint32_t flags) , boost::function<bool(std::string)> p, boost::uint32_t flags)
{ {
detail::add_files_impl(fs, parent_path(complete(file)), filename(file), p, flags); add_files_impl(fs, parent_path(complete(file)), filename(file), p, flags);
} }
void add_files(file_storage& fs, std::string const& file, boost::uint32_t flags) void add_files(file_storage& fs, std::string const& file, boost::uint32_t flags)
{ {
detail::add_files_impl(fs, parent_path(complete(file)), filename(file) add_files_impl(fs, parent_path(complete(file)), filename(file)
, detail::default_pred, flags); , default_pred, flags);
}
void on_hash(disk_io_job const* j, create_torrent* t
, boost::shared_ptr<piece_manager> storage, disk_io_thread* iothread
, int* piece_counter, int* completed_piece
, boost::function<void(int)> const* f, error_code* ec)
{
if (j->ret != 0)
{
// on error
*ec = j->error.ec;
iothread->set_num_threads(0);
return;
}
t->set_hash(j->piece, sha1_hash(j->d.piece_hash));
(*f)(*completed_piece);
++(*completed_piece);
if (*piece_counter < t->num_pieces())
{
iothread->async_hash(storage.get(), *piece_counter, disk_io_job::sequential_access
, boost::bind(&on_hash, _1, t, storage, iothread
, piece_counter, completed_piece, f, ec), (void*)0);
++(*piece_counter);
}
else
{
iothread->set_num_threads(0);
}
iothread->submit_jobs();
} }
void set_piece_hashes(create_torrent& t, std::string const& p void set_piece_hashes(create_torrent& t, std::string const& p

View File

@ -71,8 +71,10 @@ namespace libtorrent
#endif #endif
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
char const* job_name(int j); char const* job_name(int j);
// TODO: 3 decleare this function in the header file, for block_cache.cpp
void assert_print_piece(cached_piece_entry const* pe) void assert_print_piece(cached_piece_entry const* pe)
{ {
static const char* const cache_state[] = static const char* const cache_state[] =
@ -977,7 +979,8 @@ namespace libtorrent
} }
} }
void disk_io_thread::flush_expired_write_blocks(tailqueue& completed_jobs, mutex::scoped_lock& l) void disk_io_thread::flush_expired_write_blocks(tailqueue& completed_jobs
, mutex::scoped_lock& l)
{ {
DLOG("flush_expired_write_blocks\n"); DLOG("flush_expired_write_blocks\n");
@ -1024,10 +1027,12 @@ namespace libtorrent
} }
} }
namespace {
typedef int (disk_io_thread::*disk_io_fun_t)(disk_io_job* j, tailqueue& completed_jobs); typedef int (disk_io_thread::*disk_io_fun_t)(disk_io_job* j, tailqueue& completed_jobs);
// this is a jump-table for disk I/O jobs // this is a jump-table for disk I/O jobs
static const disk_io_fun_t job_functions[] = const disk_io_fun_t job_functions[] =
{ {
&disk_io_thread::do_read, &disk_io_thread::do_read,
&disk_io_thread::do_write, &disk_io_thread::do_write,
@ -1077,6 +1082,8 @@ namespace libtorrent
"tick_storage", "tick_storage",
}; };
} // anonymous namespace
#if TORRENT_USE_ASSERTS || DEBUG_DISK_THREAD #if TORRENT_USE_ASSERTS || DEBUG_DISK_THREAD
char const* job_name(int j) char const* job_name(int j)
{ {
@ -1384,14 +1391,16 @@ namespace libtorrent
return j->d.io.buffer_size; return j->d.io.buffer_size;
} }
void disk_io_thread::maybe_issue_queued_read_jobs(cached_piece_entry* pe, tailqueue& completed_jobs) void disk_io_thread::maybe_issue_queued_read_jobs(cached_piece_entry* pe
, tailqueue& completed_jobs)
{ {
TORRENT_PIECE_ASSERT(pe->outstanding_read == 1, pe); TORRENT_PIECE_ASSERT(pe->outstanding_read == 1, pe);
// if we're shutting down, just cancel the jobs // if we're shutting down, just cancel the jobs
if (m_num_threads == 0) if (m_num_threads == 0)
{ {
fail_jobs_impl(storage_error(boost::asio::error::operation_aborted), pe->read_jobs, completed_jobs); fail_jobs_impl(storage_error(boost::asio::error::operation_aborted)
, pe->read_jobs, completed_jobs);
TORRENT_PIECE_ASSERT(pe->read_jobs.size() == 0, pe); TORRENT_PIECE_ASSERT(pe->read_jobs.size() == 0, pe);
pe->outstanding_read = 0; pe->outstanding_read = 0;
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
@ -1548,7 +1557,8 @@ namespace libtorrent
// flushes the piece to disk in case // flushes the piece to disk in case
// it satisfies the condition for a write // it satisfies the condition for a write
// piece to be flushed // piece to be flushed
try_flush_hashed(pe, m_settings.get_int(settings_pack::write_cache_line_size), completed_jobs, l); try_flush_hashed(pe, m_settings.get_int(
settings_pack::write_cache_line_size), completed_jobs, l);
--pe->piece_refcount; --pe->piece_refcount;
m_disk_cache.maybe_free_piece(pe); m_disk_cache.maybe_free_piece(pe);
@ -1900,7 +1910,8 @@ namespace libtorrent
j->callback = handler; j->callback = handler;
add_fence_job(storage, j); add_fence_job(storage, j);
fail_jobs_impl(storage_error(boost::asio::error::operation_aborted), to_abort, completed_jobs); fail_jobs_impl(storage_error(boost::asio::error::operation_aborted)
, to_abort, completed_jobs);
if (completed_jobs.size()) if (completed_jobs.size())
add_completed_jobs(completed_jobs); add_completed_jobs(completed_jobs);
@ -1990,7 +2001,8 @@ namespace libtorrent
add_fence_job(storage, j); add_fence_job(storage, j);
tailqueue completed_jobs; tailqueue completed_jobs;
fail_jobs_impl(storage_error(boost::asio::error::operation_aborted), to_abort, completed_jobs); fail_jobs_impl(storage_error(boost::asio::error::operation_aborted)
, to_abort, completed_jobs);
if (completed_jobs.size()) if (completed_jobs.size())
add_completed_jobs(completed_jobs); add_completed_jobs(completed_jobs);
} }
@ -2314,7 +2326,7 @@ namespace libtorrent
return ret >= 0 ? 0 : -1; return ret >= 0 ? 0 : -1;
} }
int disk_io_thread::do_hash(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_hash(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
@ -2562,7 +2574,7 @@ namespace libtorrent
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
int disk_io_thread::do_move_storage(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_move_storage(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
// if this assert fails, something's wrong with the fence logic // if this assert fails, something's wrong with the fence logic
TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1); TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1);
@ -2599,14 +2611,15 @@ namespace libtorrent
m_disk_cache.mark_deleted(*j->storage->files()); m_disk_cache.mark_deleted(*j->storage->files());
#endif #endif
flush_cache(j->storage.get(), flush_delete_cache | flush_expect_clear, completed_jobs, l); flush_cache(j->storage.get(), flush_delete_cache | flush_expect_clear
, completed_jobs, l);
l.unlock(); l.unlock();
j->storage->get_storage_impl()->delete_files(j->error); j->storage->get_storage_impl()->delete_files(j->error);
return j->error ? -1 : 0; return j->error ? -1 : 0;
} }
int disk_io_thread::do_check_fastresume(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_check_fastresume(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
// if this assert fails, something's wrong with the fence logic // if this assert fails, something's wrong with the fence logic
TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1); TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1);
@ -2635,7 +2648,7 @@ namespace libtorrent
return j->error ? -1 : 0; return j->error ? -1 : 0;
} }
int disk_io_thread::do_rename_file(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_rename_file(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
// if this assert fails, something's wrong with the fence logic // if this assert fails, something's wrong with the fence logic
TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1); TORRENT_ASSERT(j->storage->num_outstanding_jobs() == 1);
@ -2653,7 +2666,8 @@ namespace libtorrent
// issue write commands for all dirty blocks // issue write commands for all dirty blocks
// and clear all read jobs // and clear all read jobs
mutex::scoped_lock l(m_cache_mutex); mutex::scoped_lock l(m_cache_mutex);
flush_cache(j->storage.get(), flush_read_cache | flush_write_cache, completed_jobs, l); flush_cache(j->storage.get(), flush_read_cache | flush_write_cache
, completed_jobs, l);
l.unlock(); l.unlock();
m_disk_cache.release_memory(); m_disk_cache.release_memory();
@ -2662,7 +2676,7 @@ namespace libtorrent
return j->error ? -1 : 0; return j->error ? -1 : 0;
} }
int disk_io_thread::do_cache_piece(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_cache_piece(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
TORRENT_ASSERT(j->buffer == 0); TORRENT_ASSERT(j->buffer == 0);
@ -2693,7 +2707,8 @@ namespace libtorrent
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
pe->piece_log.push_back(piece_log_t(j->action)); pe->piece_log.push_back(piece_log_t(j->action));
#endif #endif
TORRENT_PIECE_ASSERT(pe->cache_state <= cached_piece_entry::read_lru1 || pe->cache_state == cached_piece_entry::read_lru2, pe); TORRENT_PIECE_ASSERT(pe->cache_state <= cached_piece_entry::read_lru1
|| pe->cache_state == cached_piece_entry::read_lru2, pe);
++pe->piece_refcount; ++pe->piece_refcount;
int block_size = m_disk_cache.block_size(); int block_size = m_disk_cache.block_size();
@ -2763,7 +2778,7 @@ namespace libtorrent
} }
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
int disk_io_thread::do_finalize_file(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_finalize_file(disk_io_job* j, tailqueue& /* completed_jobs */)
{ {
j->storage->get_storage_impl()->finalize_file(j->piece, j->error); j->storage->get_storage_impl()->finalize_file(j->piece, j->error);
return j->error ? -1 : 0; return j->error ? -1 : 0;
@ -2918,7 +2933,8 @@ namespace libtorrent
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
pe->piece_log.push_back(piece_log_t(j->action)); pe->piece_log.push_back(piece_log_t(j->action));
#endif #endif
try_flush_hashed(pe, m_settings.get_int(settings_pack::write_cache_line_size), completed_jobs, l); try_flush_hashed(pe, m_settings.get_int(
settings_pack::write_cache_line_size), completed_jobs, l);
return 0; return 0;
} }
@ -2965,7 +2981,8 @@ namespace libtorrent
// it satisfies the condition for a write // it satisfies the condition for a write
// piece to be flushed // piece to be flushed
// #error if hash checks are disabled, always just flush // #error if hash checks are disabled, always just flush
try_flush_hashed(pe, m_settings.get_int(settings_pack::write_cache_line_size), completed_jobs, l); try_flush_hashed(pe, m_settings.get_int(
settings_pack::write_cache_line_size), completed_jobs, l);
TORRENT_ASSERT(l.locked()); TORRENT_ASSERT(l.locked());
@ -2985,13 +3002,13 @@ namespace libtorrent
return 0; return 0;
} }
int disk_io_thread::do_trim_cache(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_trim_cache(disk_io_job*, tailqueue& /* completed_jobs */)
{ {
//#error implement //#error implement
return 0; return 0;
} }
int disk_io_thread::do_file_priority(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_file_priority(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
std::vector<boost::uint8_t>* p = reinterpret_cast<std::vector<boost::uint8_t>*>(j->buffer); std::vector<boost::uint8_t>* p = reinterpret_cast<std::vector<boost::uint8_t>*>(j->buffer);
j->storage->get_storage_impl()->set_file_priority(*p, j->error); j->storage->get_storage_impl()->set_file_priority(*p, j->error);
@ -2999,7 +3016,7 @@ namespace libtorrent
return 0; return 0;
} }
int disk_io_thread::do_load_torrent(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_load_torrent(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
add_torrent_params* params = (add_torrent_params*)j->requester; add_torrent_params* params = (add_torrent_params*)j->requester;
@ -3048,7 +3065,8 @@ namespace libtorrent
tailqueue jobs; tailqueue jobs;
if (m_disk_cache.evict_piece(pe, jobs)) if (m_disk_cache.evict_piece(pe, jobs))
{ {
fail_jobs_impl(storage_error(boost::asio::error::operation_aborted), jobs, completed_jobs); fail_jobs_impl(storage_error(boost::asio::error::operation_aborted)
, jobs, completed_jobs);
return 0; return 0;
} }
@ -3061,7 +3079,7 @@ namespace libtorrent
return retry_job; return retry_job;
} }
int disk_io_thread::do_tick(disk_io_job* j, tailqueue& completed_jobs) int disk_io_thread::do_tick(disk_io_job* j, tailqueue& /* completed_jobs */ )
{ {
// true means this storage wants more ticks, false // true means this storage wants more ticks, false
// disables ticking (until it's enabled again) // disables ticking (until it's enabled again)

View File

@ -116,6 +116,8 @@ namespace libtorrent { namespace dht
TORRENT_DEFINE_LOG(dht_tracker) TORRENT_DEFINE_LOG(dht_tracker)
#endif #endif
namespace {
node_id extract_node_id(bdecode_node e) node_id extract_node_id(bdecode_node e)
{ {
if (!e || e.type() != bdecode_node::dict_t) return (node_id::min)(); if (!e || e.type() != bdecode_node::dict_t) return (node_id::min)();
@ -133,6 +135,8 @@ namespace libtorrent { namespace dht
return node_id(node_id(nid->string().c_str())); return node_id(node_id(nid->string().c_str()));
} }
} // anonymous namespace
// class that puts the networking and the kademlia node in a single // class that puts the networking and the kademlia node in a single
// unit and connecting them together. // unit and connecting them together.
dht_tracker::dht_tracker(libtorrent::aux::session_impl& ses dht_tracker::dht_tracker(libtorrent::aux::session_impl& ses
@ -268,6 +272,8 @@ namespace libtorrent { namespace dht
m_dht.announce(ih, listen_port, flags, f); m_dht.announce(ih, listen_port, flags, f);
} }
namespace {
// these functions provide a slightly higher level // these functions provide a slightly higher level
// interface to the get/put functionality in the DHT // interface to the get/put functionality in the DHT
bool get_immutable_item_callback(item& it, boost::function<void(item const&)> f) bool get_immutable_item_callback(item& it, boost::function<void(item const&)> f)
@ -305,6 +311,8 @@ namespace libtorrent { namespace dht
return true; return true;
} }
} // anonymous namespace
void dht_tracker::get_item(sha1_hash const& target void dht_tracker::get_item(sha1_hash const& target
, boost::function<void(item const&)> cb) , boost::function<void(item const&)> cb)
{ {
@ -423,6 +431,8 @@ namespace libtorrent { namespace dht
return true; return true;
} }
namespace {
void add_node_fun(void* userdata, node_entry const& e) void add_node_fun(void* userdata, node_entry const& e)
{ {
entry* n = (entry*)userdata; entry* n = (entry*)userdata;
@ -431,6 +441,8 @@ namespace libtorrent { namespace dht
write_endpoint(e.ep(), out); write_endpoint(e.ep(), out);
n->list().push_back(entry(node)); n->list().push_back(entry(node));
} }
} // anonymous namespace
entry dht_tracker::state() const entry dht_tracker::state() const
{ {

View File

@ -82,12 +82,16 @@ void find_data_observer::reply(msg const& m)
done(); done();
} }
namespace {
void add_entry_fun(void* userdata, node_entry const& e) void add_entry_fun(void* userdata, node_entry const& e)
{ {
traversal_algorithm* f = (traversal_algorithm*)userdata; traversal_algorithm* f = (traversal_algorithm*)userdata;
f->add_entry(e.id, e.ep(), observer::flag_initial); f->add_entry(e.id, e.ep(), observer::flag_initial);
} }
} // anonymous namespace
find_data::find_data( find_data::find_data(
node_impl& node node_impl& node
, node_id target , node_id target

View File

@ -64,8 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent { namespace dht namespace libtorrent { namespace dht
{ {
void incoming_error(entry& e, char const* msg, int error_code = 203);
using detail::write_endpoint; using detail::write_endpoint;
// TODO: 2 make this configurable in dht_settings // TODO: 2 make this configurable in dht_settings
@ -75,6 +73,8 @@ enum { announce_interval = 30 };
TORRENT_DEFINE_LOG(node) TORRENT_DEFINE_LOG(node)
#endif #endif
namespace {
// remove peers that have timed out // remove peers that have timed out
void purge_peers(std::set<peer_entry>& peers) void purge_peers(std::set<peer_entry>& peers)
{ {
@ -96,6 +96,8 @@ void purge_peers(std::set<peer_entry>& peers)
void nop() {} void nop() {}
} // anonymous namespace
node_impl::node_impl(udp_socket_interface* sock node_impl::node_impl(udp_socket_interface* sock
, dht_settings const& settings, node_id nid, address const& external_address , dht_settings const& settings, node_id nid, address const& external_address
, dht_observer* observer , dht_observer* observer
@ -645,7 +647,7 @@ void node_impl::lookup_peers(sha1_hash const& info_hash, entry& reply
return; return;
} }
namespace detail namespace
{ {
void TORRENT_EXTRA_EXPORT write_nodes_entry(entry& r, nodes_t const& nodes) void TORRENT_EXTRA_EXPORT write_nodes_entry(entry& r, nodes_t const& nodes)
{ {
@ -661,8 +663,6 @@ namespace detail
} }
} }
using detail::write_nodes_entry;
// verifies that a message has all the required // verifies that a message has all the required
// entries and returns them in ret // entries and returns them in ret
bool verify_message(bdecode_node const& message, key_desc_t const desc[] bool verify_message(bdecode_node const& message, key_desc_t const desc[]

View File

@ -268,10 +268,8 @@ void rpc_manager::unreachable(udp::endpoint const& ep)
} }
} }
// defined in node.cpp bool rpc_manager::incoming(msg const& m, node_id* id
void incoming_error(entry& e, char const* msg, int error_code = 203); , libtorrent::dht_settings const& settings)
bool rpc_manager::incoming(msg const& m, node_id* id, libtorrent::dht_settings const& settings)
{ {
INVARIANT_CHECK; INVARIANT_CHECK;

View File

@ -1132,10 +1132,13 @@ namespace libtorrent
#endif #endif
} }
// single_peer is true if the entire piece was received by a single
// peer
bool peer_connection::received_invalid_data(int index, bool single_peer) bool peer_connection::received_invalid_data(int index, bool single_peer)
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
INVARIANT_CHECK; INVARIANT_CHECK;
TORRENT_UNUSED(single_peer);
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
for (extension_list_t::iterator i = m_extensions.begin() for (extension_list_t::iterator i = m_extensions.begin()
@ -1145,6 +1148,8 @@ namespace libtorrent
(*i)->on_piece_failed(index); (*i)->on_piece_failed(index);
} TORRENT_CATCH(std::exception&) {} } TORRENT_CATCH(std::exception&) {}
} }
#else
TORRENT_UNUSED(index);
#endif #endif
return true; return true;
} }

View File

@ -444,6 +444,9 @@ namespace libtorrent
int h = have[i]; int h = have[i];
TORRENT_ASSERT(m_piece_map[i].have_peers.count(p) == h); TORRENT_ASSERT(m_piece_map[i].have_peers.count(p) == h);
} }
#else
TORRENT_UNUSED(have);
TORRENT_UNUSED(p);
#endif #endif
} }
@ -1152,6 +1155,8 @@ namespace libtorrent
TORRENT_ASSERT(i->have_peers.count(peer) == 0); TORRENT_ASSERT(i->have_peers.count(peer) == 0);
i->have_peers.insert(peer); i->have_peers.insert(peer);
} }
#else
TORRENT_UNUSED(peer);
#endif #endif
} }
@ -1178,6 +1183,8 @@ namespace libtorrent
TORRENT_ASSERT(i->have_peers.count(peer) == 1); TORRENT_ASSERT(i->have_peers.count(peer) == 1);
i->have_peers.erase(peer); i->have_peers.erase(peer);
} }
#else
TORRENT_UNUSED(peer);
#endif #endif
return; return;
} }
@ -1189,6 +1196,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(i->have_peers.count(peer) == 1); TORRENT_ASSERT(i->have_peers.count(peer) == 1);
i->have_peers.erase(peer); i->have_peers.erase(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
TORRENT_ASSERT(i->peer_count > 0); TORRENT_ASSERT(i->peer_count > 0);
@ -1212,6 +1221,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(p.have_peers.count(peer) == 0); TORRENT_ASSERT(p.have_peers.count(peer) == 0);
p.have_peers.insert(peer); p.have_peers.insert(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
int prev_priority = p.priority(this); int prev_priority = p.priority(this);
@ -1274,6 +1285,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(p.have_peers.count(peer) == 1); TORRENT_ASSERT(p.have_peers.count(peer) == 1);
p.have_peers.erase(peer); p.have_peers.erase(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
TORRENT_ASSERT(p.peer_count > 0); TORRENT_ASSERT(p.peer_count > 0);
@ -1341,6 +1354,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(p.have_peers.count(peer) == 0); TORRENT_ASSERT(p.have_peers.count(peer) == 0);
p.have_peers.insert(peer); p.have_peers.insert(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
int new_priority = p.priority(this); int new_priority = p.priority(this);
if (prev_priority == new_priority) continue; if (prev_priority == new_priority) continue;
@ -1361,6 +1376,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(m_piece_map[index].have_peers.count(peer) == 0); TORRENT_ASSERT(m_piece_map[index].have_peers.count(peer) == 0);
m_piece_map[index].have_peers.insert(peer); m_piece_map[index].have_peers.insert(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
++m_piece_map[index].peer_count; ++m_piece_map[index].peer_count;
@ -1444,6 +1461,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(p.have_peers.count(peer) == 1); TORRENT_ASSERT(p.have_peers.count(peer) == 1);
p.have_peers.erase(peer); p.have_peers.erase(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
TORRENT_ASSERT(p.peer_count > 0); TORRENT_ASSERT(p.peer_count > 0);
--p.peer_count; --p.peer_count;
@ -1474,6 +1493,8 @@ namespace libtorrent
#ifdef TORRENT_DEBUG_REFCOUNTS #ifdef TORRENT_DEBUG_REFCOUNTS
TORRENT_ASSERT(p.have_peers.count(peer) == 1); TORRENT_ASSERT(p.have_peers.count(peer) == 1);
p.have_peers.erase(peer); p.have_peers.erase(peer);
#else
TORRENT_UNUSED(peer);
#endif #endif
TORRENT_ASSERT(p.peer_count > 0); TORRENT_ASSERT(p.peer_count > 0);
@ -1591,8 +1612,10 @@ namespace libtorrent
piece_pos& p = m_piece_map[index]; piece_pos& p = m_piece_map[index];
#ifdef TORRENT_PICKER_LOG #ifdef TORRENT_PICKER_LOG
std::cerr << "[" << this << "] " << "piece_picker::we_dont_have(" << index << ")" << std::endl; std::cerr << "[" << this << "] " << "piece_picker::we_dont_have("
<< index << ")" << std::endl;
#endif #endif
if (!p.have()) if (!p.have())
{ {
// even though we don't have the piece, it // even though we don't have the piece, it
@ -1653,7 +1676,8 @@ namespace libtorrent
TORRENT_ASSERT(index < (int)m_piece_map.size()); TORRENT_ASSERT(index < (int)m_piece_map.size());
#ifdef TORRENT_PICKER_LOG #ifdef TORRENT_PICKER_LOG
std::cerr << "[" << this << "] " << "piece_picker::we_have(" << index << ")" << std::endl; std::cerr << "[" << this << "] " << "piece_picker::we_have("
<< index << ")" << std::endl;
#endif #endif
piece_pos& p = m_piece_map[index]; piece_pos& p = m_piece_map[index];
int info_index = p.index; int info_index = p.index;
@ -1743,7 +1767,8 @@ namespace libtorrent
#endif #endif
#ifdef TORRENT_PICKER_LOG #ifdef TORRENT_PICKER_LOG
std::cerr << "[" << this << "] " << "set_piece_priority(" << index << ", " << new_piece_priority << ")" << std::endl; std::cerr << "[" << this << "] " << "set_piece_priority(" << index
<< ", " << new_piece_priority << ")" << std::endl;
#endif #endif
TORRENT_ASSERT(new_piece_priority >= 0); TORRENT_ASSERT(new_piece_priority >= 0);

View File

@ -680,7 +680,7 @@ namespace libtorrent
, sha1_hash const& info_hash , sha1_hash const& info_hash
, char const* name , char const* name
, std::string const& save_path , std::string const& save_path
, entry const& e , entry const& resume_data
, storage_mode_t storage_mode , storage_mode_t storage_mode
, bool paused , bool paused
, storage_constructor_type sc , storage_constructor_type sc
@ -690,8 +690,14 @@ namespace libtorrent
p.tracker_url = tracker_url; p.tracker_url = tracker_url;
p.info_hash = info_hash; p.info_hash = info_hash;
p.save_path = save_path; p.save_path = save_path;
p.storage_mode = storage_mode;
p.paused = paused; p.paused = paused;
p.userdata = userdata; p.userdata = userdata;
p.name = name;
if (resume_data.type() != entry::undefined_t)
{
bencode(std::back_inserter(p.resume_data), resume_data);
}
return add_torrent(p); return add_torrent(p);
} }
#endif // TORRENT_NO_DEPRECATE #endif // TORRENT_NO_DEPRECATE
@ -1062,7 +1068,7 @@ namespace libtorrent
return ret; return ret;
} }
void session::set_max_half_open_connections(int limit) {} void session::set_max_half_open_connections(int) {}
int session::max_half_open_connections() const { return 8; } int session::max_half_open_connections() const { return 8; }
int session::max_uploads() const int session::max_uploads() const

View File

@ -658,21 +658,25 @@ namespace libtorrent
else else
{ {
file_status s; file_status s;
error_code ec; error_code error;
stat_file(fs.file_path(i, m_save_path), &s, ec); stat_file(fs.file_path(i, m_save_path), &s, error);
if (!ec) if (!error)
{ {
file_size = s.file_size; file_size = s.file_size;
file_time = s.mtime; file_time = s.mtime;
} }
else else
{ {
if (ec == boost::system::errc::no_such_file_or_directory) if (error == error_code(boost::system::errc::no_such_file_or_directory
, generic_category()))
{ {
m_stat_cache.set_noexist(i); m_stat_cache.set_noexist(i);
} }
else else
{ {
ec.ec = error;
ec.file = i;
ec.operation = storage_error::stat;
m_stat_cache.set_error(i); m_stat_cache.set_error(i);
} }
} }
@ -1386,7 +1390,7 @@ namespace libtorrent
// -- zero_storage ------------------------------------------------------ // -- zero_storage ------------------------------------------------------
int zero_storage::readv(file::iovec_t const* bufs, int num_bufs int zero_storage::readv(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) , int /* piece */, int /* offset */, int /* flags */, storage_error&)
{ {
int ret = 0; int ret = 0;
for (int i = 0; i < num_bufs; ++i) for (int i = 0; i < num_bufs; ++i)
@ -1398,7 +1402,7 @@ namespace libtorrent
} }
int zero_storage::writev(file::iovec_t const* bufs, int num_bufs int zero_storage::writev(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) , int /* piece */, int /* offset */, int /* flags */, storage_error& ec)
{ {
int ret = 0; int ret = 0;
for (int i = 0; i < num_bufs; ++i) for (int i = 0; i < num_bufs; ++i)
@ -1406,7 +1410,7 @@ namespace libtorrent
return 0; return 0;
} }
storage_interface* zero_storage_constructor(storage_params const& params) storage_interface* zero_storage_constructor(storage_params const&)
{ {
return new zero_storage; return new zero_storage;
} }

View File

@ -105,6 +105,8 @@ using boost::tuples::make_tuple;
namespace libtorrent namespace libtorrent
{ {
namespace {
int root2(int x) int root2(int x)
{ {
int ret = 0; int ret = 0;
@ -120,6 +122,8 @@ namespace libtorrent
return ret; return ret;
} }
} // anonymous namespace
web_seed_t::web_seed_t(web_seed_entry const& wse) web_seed_t::web_seed_t(web_seed_entry const& wse)
: web_seed_entry(wse) : web_seed_entry(wse)
, retry(aux::time_now()) , retry(aux::time_now())
@ -1167,6 +1171,9 @@ namespace libtorrent
void torrent::on_piece_fail_sync(disk_io_job const* j, piece_block b) void torrent::on_piece_fail_sync(disk_io_job const* j, piece_block b)
{ {
TORRENT_UNUSED(j);
TORRENT_UNUSED(b);
update_gauge(); update_gauge();
// some peers that previously was no longer interesting may // some peers that previously was no longer interesting may
// now have become interesting, since we lack this one piece now. // now have become interesting, since we lack this one piece now.
@ -2018,6 +2025,8 @@ namespace libtorrent
void torrent::dec_refcount(char const* purpose) void torrent::dec_refcount(char const* purpose)
{ {
TORRENT_UNUSED(purpose);
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(m_refcount > 0); TORRENT_ASSERT(m_refcount > 0);
--m_refcount; --m_refcount;
@ -2033,6 +2042,8 @@ namespace libtorrent
void torrent::inc_refcount(char const* purpose) void torrent::inc_refcount(char const* purpose)
{ {
TORRENT_UNUSED(purpose);
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(is_loaded()); TORRENT_ASSERT(is_loaded());
++m_refcount; ++m_refcount;
@ -2578,8 +2589,6 @@ namespace libtorrent
#endif #endif
} }
void nop() {}
// This is only used for checking of torrents. i.e. force-recheck or initial checking // This is only used for checking of torrents. i.e. force-recheck or initial checking
// of existing files // of existing files
void torrent::on_piece_hashed(disk_io_job const* j) void torrent::on_piece_hashed(disk_io_job const* j)
@ -5646,8 +5655,12 @@ namespace libtorrent
} }
} }
namespace {
bool has_empty_url(announce_entry const& e) { return e.url.empty(); } bool has_empty_url(announce_entry const& e) { return e.url.empty(); }
}
void torrent::replace_trackers(std::vector<announce_entry> const& urls) void torrent::replace_trackers(std::vector<announce_entry> const& urls)
{ {
m_trackers.clear(); m_trackers.clear();
@ -7545,6 +7558,8 @@ namespace libtorrent
return true; return true;
} }
namespace {
bool connecting_time_compare(peer_connection const* lhs, peer_connection const* rhs) bool connecting_time_compare(peer_connection const* lhs, peer_connection const* rhs)
{ {
bool lhs_connecting = lhs->is_connecting() && !lhs->is_disconnecting(); bool lhs_connecting = lhs->is_connecting() && !lhs->is_disconnecting();
@ -7558,6 +7573,8 @@ namespace libtorrent
return lhs->connected_time() > rhs->connected_time(); return lhs->connected_time() > rhs->connected_time();
} }
} // anonymous namespaec
bool torrent::attach_peer(peer_connection* p) bool torrent::attach_peer(peer_connection* p)
{ {
// INVARIANT_CHECK; // INVARIANT_CHECK;
@ -7926,6 +7943,8 @@ namespace libtorrent
update_want_tick(); update_want_tick();
} }
namespace {
// this returns true if lhs is a better disconnect candidate than rhs // this returns true if lhs is a better disconnect candidate than rhs
bool compare_disconnect_peer(peer_connection const* lhs, peer_connection const* rhs) bool compare_disconnect_peer(peer_connection const* lhs, peer_connection const* rhs)
{ {
@ -7965,6 +7984,8 @@ namespace libtorrent
return lhs->last_received() < rhs->last_received(); return lhs->last_received() < rhs->last_received();
} }
} // anonymous namespace
int torrent::disconnect_peers(int num, error_code const& ec) int torrent::disconnect_peers(int num, error_code const& ec)
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
@ -10191,6 +10212,8 @@ namespace libtorrent
} }
#endif // TORRENT_DEBUG_STREAMING #endif // TORRENT_DEBUG_STREAMING
namespace {
struct busy_block_t struct busy_block_t
{ {
int peers; int peers;
@ -10449,6 +10472,8 @@ namespace libtorrent
} while (!interesting_blocks.empty()); } while (!interesting_blocks.empty());
} }
} // anonymous namespace
void torrent::request_time_critical_pieces() void torrent::request_time_critical_pieces()
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());

View File

@ -344,6 +344,11 @@ namespace libtorrent
{ {
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
TORRENT_ASYNC_CALL4(set_ssl_cert, certificate, private_key, dh_params, passphrase); TORRENT_ASYNC_CALL4(set_ssl_cert, certificate, private_key, dh_params, passphrase);
#else
TORRENT_UNUSED(certificate);
TORRENT_UNUSED(private_key);
TORRENT_UNUSED(dh_params);
TORRENT_UNUSED(passphrase);
#endif #endif
} }
@ -354,6 +359,10 @@ namespace libtorrent
{ {
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
TORRENT_ASYNC_CALL3(set_ssl_cert_buffer, certificate, private_key, dh_params); TORRENT_ASYNC_CALL3(set_ssl_cert_buffer, certificate, private_key, dh_params);
#else
TORRENT_UNUSED(certificate);
TORRENT_UNUSED(private_key);
TORRENT_UNUSED(dh_params);
#endif #endif
} }
@ -506,11 +515,11 @@ namespace libtorrent
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// ============ start deprecation =============== // ============ start deprecation ===============
int torrent_handle::get_peer_upload_limit(tcp::endpoint ip) const { return -1; } int torrent_handle::get_peer_upload_limit(tcp::endpoint) const { return -1; }
int torrent_handle::get_peer_download_limit(tcp::endpoint ip) const { return -1; } int torrent_handle::get_peer_download_limit(tcp::endpoint) const { return -1; }
void torrent_handle::set_peer_upload_limit(tcp::endpoint ip, int limit) const {} void torrent_handle::set_peer_upload_limit(tcp::endpoint, int /* limit */) const {}
void torrent_handle::set_peer_download_limit(tcp::endpoint ip, int limit) const {} void torrent_handle::set_peer_download_limit(tcp::endpoint, int /* limit */) const {}
void torrent_handle::set_ratio(float ratio) const {} void torrent_handle::set_ratio(float) const {}
void torrent_handle::use_interface(const char* net_interface) const void torrent_handle::use_interface(const char* net_interface) const
{ {
TORRENT_ASYNC_CALL1(use_interface, std::string(net_interface)); TORRENT_ASYNC_CALL1(use_interface, std::string(net_interface));