forked from premiere/premiere-libtorrent
fix warnings
This commit is contained in:
parent
d18495eb39
commit
607e708bc4
|
@ -188,10 +188,6 @@ namespace libtorrent
|
|||
void set_load_function(user_load_function_t fun)
|
||||
{ m_user_load_torrent = fun; }
|
||||
|
||||
void queue_async_resume_data(boost::shared_ptr<torrent> const& t);
|
||||
void done_async_resume();
|
||||
void async_resume_dispatched(int num_popped_resume);
|
||||
|
||||
void init_peer_class_filter(bool unlimited_local);
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
|
@ -213,7 +209,7 @@ namespace libtorrent
|
|||
|
||||
void open_listen_port();
|
||||
void init_settings();
|
||||
|
||||
|
||||
torrent_peer_allocator_interface* get_peer_allocator() { return &m_peer_allocator; }
|
||||
|
||||
io_service& get_io_service() { return m_io_service; }
|
||||
|
@ -247,7 +243,7 @@ namespace libtorrent
|
|||
, error_code const& e);
|
||||
|
||||
void incoming_connection(boost::shared_ptr<socket_type> const& s);
|
||||
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
feed_handle add_feed(feed_settings const& feed);
|
||||
void remove_feed(feed_handle h);
|
||||
|
@ -283,7 +279,7 @@ namespace libtorrent
|
|||
void apply_settings_pack(settings_pack* pack);
|
||||
session_settings const& settings() const { return m_settings; }
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
dht::dht_tracker* dht() { return m_dht.get(); }
|
||||
bool announce_dht() const { return !m_listen_sockets.empty(); }
|
||||
|
||||
|
@ -355,7 +351,7 @@ namespace libtorrent
|
|||
|
||||
void set_ip_filter(boost::shared_ptr<ip_filter> const& f);
|
||||
ip_filter const& get_ip_filter();
|
||||
|
||||
|
||||
void set_port_filter(port_filter const& f);
|
||||
port_filter const& get_port_filter() const TORRENT_OVERRIDE;
|
||||
void ban_ip(address addr) TORRENT_OVERRIDE;
|
||||
|
@ -373,13 +369,13 @@ namespace libtorrent
|
|||
int copy_pertinent_channels(peer_class_set const& set
|
||||
, int channel, bandwidth_channel** dst, int max);
|
||||
int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up);
|
||||
bool use_quota_overhead(bandwidth_channel* ch, int channel, int amount);
|
||||
bool use_quota_overhead(bandwidth_channel* ch, int amount);
|
||||
|
||||
int create_peer_class(char const* name);
|
||||
void delete_peer_class(int cid);
|
||||
void set_peer_class_filter(ip_filter const& f);
|
||||
ip_filter const& get_peer_class_filter() const;
|
||||
|
||||
|
||||
void set_peer_class_type_filter(peer_class_type_filter f);
|
||||
peer_class_type_filter get_peer_class_type_filter();
|
||||
|
||||
|
@ -411,7 +407,7 @@ namespace libtorrent
|
|||
void post_dht_stats();
|
||||
|
||||
std::vector<torrent_handle> get_torrents() const;
|
||||
|
||||
|
||||
void pop_alerts(std::vector<alert*>* alerts);
|
||||
alert* wait_for_alert(time_duration max_wait);
|
||||
|
||||
|
@ -474,12 +470,12 @@ namespace libtorrent
|
|||
address listen_address() const;
|
||||
boost::uint16_t listen_port() const;
|
||||
boost::uint16_t ssl_listen_port() const;
|
||||
|
||||
|
||||
alert_manager& alerts() { return m_alerts; }
|
||||
disk_interface& disk_thread() { return m_disk_thread; }
|
||||
|
||||
void abort();
|
||||
|
||||
|
||||
torrent_handle find_torrent_handle(sha1_hash const& info_hash);
|
||||
|
||||
void announce_lsd(sha1_hash const& ih, int port, bool broadcast = false);
|
||||
|
@ -556,7 +552,7 @@ namespace libtorrent
|
|||
char* async_allocate_disk_buffer(char const* category
|
||||
, boost::function<void(char*)> const& handler);
|
||||
void reclaim_block(block_cache_reference ref);
|
||||
|
||||
|
||||
bool exceeded_cache_use() const
|
||||
{ return m_disk_thread.exceeded_cache_use(); }
|
||||
|
||||
|
@ -643,7 +639,7 @@ namespace libtorrent
|
|||
void update_peer_fingerprint();
|
||||
|
||||
void on_trigger_auto_manage();
|
||||
|
||||
|
||||
void update_socket_buffer_size();
|
||||
void update_dht_announce_interval();
|
||||
void update_anonymous_mode();
|
||||
|
@ -756,7 +752,7 @@ namespace libtorrent
|
|||
// shouldn't. Each torrent that's loaded is part of this
|
||||
// list.
|
||||
linked_list m_torrent_lru;
|
||||
|
||||
|
||||
std::map<std::string, boost::shared_ptr<torrent> > m_uuids;
|
||||
|
||||
// when saving resume data for many torrents, torrents are
|
||||
|
@ -793,7 +789,7 @@ namespace libtorrent
|
|||
// the session, all of these are disconnected, otherwise
|
||||
// they would linger and stall or hang session shutdown
|
||||
std::set<boost::shared_ptr<socket_type> > m_incoming_sockets;
|
||||
|
||||
|
||||
// maps IP ranges to bitfields representing peer class IDs
|
||||
// to assign peers matching a specific IP range based on its
|
||||
// remote endpoint
|
||||
|
@ -807,7 +803,7 @@ namespace libtorrent
|
|||
|
||||
// filters outgoing connections
|
||||
port_filter m_port_filter;
|
||||
|
||||
|
||||
// the peer id that is generated at the start of the session
|
||||
peer_id m_peer_id;
|
||||
|
||||
|
@ -851,7 +847,7 @@ namespace libtorrent
|
|||
// on this machine
|
||||
tcp::endpoint m_ipv6_interface;
|
||||
tcp::endpoint m_ipv4_interface;
|
||||
|
||||
|
||||
// since we might be listening on multiple interfaces
|
||||
// we might need more than one listen socket
|
||||
std::list<listen_socket_t> m_listen_sockets;
|
||||
|
@ -885,7 +881,7 @@ namespace libtorrent
|
|||
listen_socket_t setup_listener(std::string const& device
|
||||
, bool ipv4, int port, int& retries, int flags, error_code& ec);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
entry m_dht_state;
|
||||
#endif
|
||||
|
||||
|
@ -990,7 +986,7 @@ namespace libtorrent
|
|||
#ifndef TORRENT_DISABLE_DHT
|
||||
boost::shared_ptr<dht::dht_tracker> m_dht;
|
||||
dht_settings m_dht_settings;
|
||||
|
||||
|
||||
// these are used when starting the DHT
|
||||
// (and bootstrapping it), and then erased
|
||||
std::list<udp::endpoint> m_dht_router_nodes;
|
||||
|
@ -1131,6 +1127,12 @@ namespace libtorrent
|
|||
|
||||
private:
|
||||
|
||||
// TODO: 2 the throttling of saving resume data could probably be
|
||||
// factored out into a separate class
|
||||
void queue_async_resume_data(boost::shared_ptr<torrent> const& t);
|
||||
void done_async_resume();
|
||||
void async_resume_dispatched();
|
||||
|
||||
// state for keeping track of external IPs
|
||||
external_ip m_external_ip;
|
||||
|
||||
|
@ -1146,14 +1148,14 @@ namespace libtorrent
|
|||
// this is true whenever we have posted a deferred-disk job
|
||||
// it means we don't need to post another one
|
||||
bool m_deferred_submit_disk_jobs;
|
||||
|
||||
|
||||
// this is set to true when a torrent auto-manage
|
||||
// event is triggered, and reset whenever the message
|
||||
// is delivered and the auto-manage is executed.
|
||||
// there should never be more than a single pending auto-manage
|
||||
// message in-flight at any given time.
|
||||
bool m_pending_auto_manage;
|
||||
|
||||
|
||||
// this is also set to true when triggering an auto-manage
|
||||
// of the torrents. However, if the normal auto-manage
|
||||
// timer comes along and executes the auto-management,
|
||||
|
|
|
@ -276,7 +276,7 @@ namespace libtorrent { namespace aux
|
|||
virtual void trancieve_ip_packet(int bytes, bool ipv6) = 0;
|
||||
virtual void sent_syn(bool ipv6) = 0;
|
||||
virtual void received_synack(bool ipv6) = 0;
|
||||
|
||||
|
||||
virtual int peak_up_rate() const = 0;
|
||||
|
||||
enum torrent_list_index
|
||||
|
@ -316,7 +316,7 @@ namespace libtorrent { namespace aux
|
|||
#ifdef TORRENT_USE_OPENSSL
|
||||
virtual boost::asio::ssl::context* ssl_ctx() = 0 ;
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||
virtual torrent const* find_encrypted_torrent(
|
||||
sha1_hash const& info_hash, sha1_hash const& xor_mask) = 0;
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace libtorrent
|
|||
|
||||
// the number of dirty blocks in this piece
|
||||
boost::uint64_t num_dirty:14;
|
||||
|
||||
|
||||
// the number of blocks in the cache for this piece
|
||||
boost::uint64_t num_blocks:14;
|
||||
|
||||
|
@ -430,7 +430,7 @@ namespace libtorrent
|
|||
// associates the job with it. When the block is
|
||||
// flushed, the callback is posted
|
||||
cached_piece_entry* add_dirty_block(disk_io_job* j);
|
||||
|
||||
|
||||
enum { blocks_inc_refcount = 1 };
|
||||
void insert_blocks(cached_piece_entry* pe, int block, file::iovec_t *iov
|
||||
, int iov_len, disk_io_job* j, int flags = 0);
|
||||
|
@ -438,7 +438,7 @@ namespace libtorrent
|
|||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
void check_invariant() const;
|
||||
#endif
|
||||
|
||||
|
||||
// try to remove num number of read cache blocks from the cache
|
||||
// pick the least recently used ones first
|
||||
// return the number of blocks that was requested to be evicted
|
||||
|
|
|
@ -133,9 +133,8 @@ namespace libtorrent {
|
|||
|
||||
TORRENT_ASSERT(m_size > 1);
|
||||
uintptr_t* ptr = m_storage;
|
||||
header_t* hdr = reinterpret_cast<header_t*>(ptr);
|
||||
TORRENT_ASSERT(reinterpret_cast<header_t*>(ptr)->len <= m_size);
|
||||
ptr += header_size;
|
||||
TORRENT_ASSERT(hdr->len <= m_size);
|
||||
return reinterpret_cast<T*>(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace libtorrent
|
|||
list_node* m_current;
|
||||
};
|
||||
|
||||
// TOOD: 3 move the code into a .cpp file and add a unit test for linked_list
|
||||
struct linked_list
|
||||
{
|
||||
linked_list(): m_first(0), m_last(0), m_size(0) {}
|
||||
|
@ -68,7 +69,7 @@ namespace libtorrent
|
|||
|
||||
void erase(list_node* e)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
list_node* tmp = m_first;
|
||||
bool found = false;
|
||||
while (tmp)
|
||||
|
|
|
@ -62,7 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/asio/read.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
#endif
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace libtorrent
|
|||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
||||
#ifndef IPV6_PROTECTION_LEVEL
|
||||
|
|
|
@ -71,7 +71,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
accessor, the piece is promoted into LRU2. which holds pieces that are
|
||||
more frequently used, and more important to keep around as this LRU list
|
||||
takes churn.
|
||||
|
||||
|
||||
read_lru1_ghost
|
||||
This is a list of pieces that were least recently evicted from read_lru1.
|
||||
These pieces don't hold any actual blocks in the cache, they are just
|
||||
|
@ -1240,6 +1240,7 @@ void block_cache::insert_blocks(cached_piece_entry* pe, int block, file::iovec_t
|
|||
if (flags & blocks_inc_refcount)
|
||||
{
|
||||
bool ret = inc_block_refcount(pe, block, ref_reading);
|
||||
TORRENT_UNUSED(ret); // suppress warning
|
||||
TORRENT_ASSERT(ret);
|
||||
}
|
||||
else
|
||||
|
@ -1710,7 +1711,7 @@ int block_cache::copy_from_piece(cached_piece_entry* pe, disk_io_job* j
|
|||
TORRENT_PIECE_ASSERT(size <= block_size(), pe);
|
||||
const int start_block = block;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
int piece_size = j->storage->files()->piece_size(j->piece);
|
||||
int blocks_in_piece = (piece_size + block_size() - 1) / block_size();
|
||||
TORRENT_PIECE_ASSERT(start_block < blocks_in_piece, pe);
|
||||
|
@ -1810,6 +1811,7 @@ bool block_cache::maybe_free_piece(cached_piece_entry* pe)
|
|||
|
||||
tailqueue jobs;
|
||||
bool removed = evict_piece(pe, jobs);
|
||||
TORRENT_UNUSED(removed); // suppress warning
|
||||
TORRENT_PIECE_ASSERT(removed, pe);
|
||||
TORRENT_PIECE_ASSERT(jobs.empty(), pe);
|
||||
|
||||
|
|
|
@ -586,10 +586,13 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
void bt_peer_connection::write_pe_vc_cryptofield(char* write_buf, int len
|
||||
void bt_peer_connection::write_pe_vc_cryptofield(char* write_buf, int len
|
||||
, int crypto_field, int pad_size)
|
||||
{
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
#if !TORRENT_USE_ASSERTS
|
||||
TORRENT_UNUSED(len);
|
||||
#endif
|
||||
|
||||
TORRENT_ASSERT(crypto_field <= 0x03 && crypto_field > 0);
|
||||
// vc,crypto_field,len(pad),pad, (len(ia))
|
||||
|
@ -599,7 +602,7 @@ namespace libtorrent
|
|||
|
||||
// encrypt(vc, crypto_provide/select, len(Pad), len(IA))
|
||||
// len(pad) is zero for now, len(IA) only for outgoing connections
|
||||
|
||||
|
||||
// vc
|
||||
memset(write_buf, 0, 8);
|
||||
write_buf += 8;
|
||||
|
@ -614,14 +617,14 @@ namespace libtorrent
|
|||
// append len(ia) if we are initiating
|
||||
if (is_outgoing())
|
||||
detail::write_uint16(handshake_len, write_buf); // len(IA)
|
||||
}
|
||||
}
|
||||
|
||||
void bt_peer_connection::init_pe_rc4_handler(char const* secret, sha1_hash const& stream_key)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
TORRENT_ASSERT(secret);
|
||||
|
||||
|
||||
hasher h;
|
||||
static const char keyA[] = "keyA";
|
||||
static const char keyB[] = "keyB";
|
||||
|
@ -629,7 +632,7 @@ namespace libtorrent
|
|||
// encryption rc4 longkeys
|
||||
// outgoing connection : hash ('keyA',S,SKEY)
|
||||
// incoming connection : hash ('keyB',S,SKEY)
|
||||
|
||||
|
||||
if (is_outgoing()) h.update(keyA, 4); else h.update(keyB, 4);
|
||||
h.update(secret, dh_key_len);
|
||||
h.update((char const*)stream_key.begin(), 20);
|
||||
|
@ -640,12 +643,12 @@ namespace libtorrent
|
|||
// decryption rc4 longkeys
|
||||
// outgoing connection : hash ('keyB',S,SKEY)
|
||||
// incoming connection : hash ('keyA',S,SKEY)
|
||||
|
||||
|
||||
if (is_outgoing()) h.update(keyB, 4); else h.update(keyA, 4);
|
||||
h.update(secret, dh_key_len);
|
||||
h.update((char const*)stream_key.begin(), 20);
|
||||
const sha1_hash remote_key = h.final();
|
||||
|
||||
|
||||
TORRENT_ASSERT(!m_rc4.get());
|
||||
m_rc4 = boost::make_shared<rc4_handler>();
|
||||
|
||||
|
@ -1953,14 +1956,15 @@ namespace libtorrent
|
|||
|
||||
TORRENT_ASSERT(m_message_handler[packet_type] != 0);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
boost::int64_t cur_payload_dl = statistics().last_payload_downloaded();
|
||||
boost::int64_t cur_protocol_dl = statistics().last_protocol_downloaded();
|
||||
#endif
|
||||
|
||||
// call the correct handler for this packet type
|
||||
(this->*m_message_handler[packet_type])(received);
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded() - cur_payload_dl >= 0);
|
||||
TORRENT_ASSERT(statistics().last_protocol_downloaded() - cur_protocol_dl >= 0);
|
||||
boost::int64_t stats_diff = statistics().last_payload_downloaded() - cur_payload_dl +
|
||||
|
@ -1993,7 +1997,7 @@ namespace libtorrent
|
|||
void bt_peer_connection::write_upload_only()
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
||||
boost::shared_ptr<torrent> t = associated_torrent().lock();
|
||||
if (m_upload_only_id == 0) return;
|
||||
if (t->share_mode()) return;
|
||||
|
@ -3521,7 +3525,7 @@ namespace libtorrent
|
|||
disconnect(errors::torrent_removed, op_bittorrent, 1);
|
||||
return;
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
boost::int64_t cur_payload_dl = statistics().last_payload_downloaded();
|
||||
boost::int64_t cur_protocol_dl = statistics().last_protocol_downloaded();
|
||||
#endif
|
||||
|
@ -3530,14 +3534,15 @@ namespace libtorrent
|
|||
m_state = read_packet_size;
|
||||
m_recv_buffer.reset(5);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded() - cur_payload_dl >= 0);
|
||||
TORRENT_ASSERT(statistics().last_protocol_downloaded() - cur_protocol_dl >= 0);
|
||||
boost::int64_t stats_diff = statistics().last_payload_downloaded() - cur_payload_dl +
|
||||
statistics().last_protocol_downloaded() - cur_protocol_dl;
|
||||
TORRENT_ASSERT(stats_diff == boost::int64_t(bytes_transferred));
|
||||
#endif
|
||||
TORRENT_ASSERT(!m_recv_buffer.packet_finished());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -580,6 +580,8 @@ namespace libtorrent
|
|||
// it should always suceed, since it's a dirty block, and
|
||||
// should never have been marked as volatile
|
||||
TORRENT_ASSERT(locked);
|
||||
TORRENT_ASSERT(pe->cache_state != cached_piece_entry::volatile_read_lru);
|
||||
TORRENT_UNUSED(locked);
|
||||
|
||||
flushing[num_flushing++] = i + block_base_index;
|
||||
iov[iov_len].iov_base = pe->blocks[i].buf;
|
||||
|
@ -1315,7 +1317,11 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(pe->blocks[block].buf);
|
||||
|
||||
int tmp = m_disk_cache.try_read(j, true);
|
||||
|
||||
// This should always succeed because we just checked to see there is a
|
||||
// buffer for this block
|
||||
TORRENT_ASSERT(tmp >= 0);
|
||||
TORRENT_UNUSED(tmp);
|
||||
|
||||
maybe_issue_queued_read_jobs(pe, completed_jobs);
|
||||
|
||||
|
@ -1679,9 +1685,7 @@ namespace libtorrent
|
|||
if (m_settings.get_int(settings_pack::cache_size) > 0
|
||||
&& m_settings.get_bool(settings_pack::use_write_cache))
|
||||
{
|
||||
int block_size = m_disk_cache.block_size();
|
||||
|
||||
TORRENT_ASSERT((r.start % block_size) == 0);
|
||||
TORRENT_ASSERT((r.start % m_disk_cache.block_size()) == 0);
|
||||
|
||||
if (storage->is_blocked(j))
|
||||
{
|
||||
|
@ -2103,6 +2107,7 @@ namespace libtorrent
|
|||
tailqueue jobs;
|
||||
bool ok = m_disk_cache.evict_piece(pe, jobs);
|
||||
TORRENT_PIECE_ASSERT(ok, pe);
|
||||
TORRENT_UNUSED(ok);
|
||||
fail_jobs(storage_error(boost::asio::error::operation_aborted), jobs);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ namespace libtorrent
|
|||
, utp_socket_manager* sm
|
||||
, bool peer_connection)
|
||||
{
|
||||
#ifndef TORRENT_USE_OPENSSL
|
||||
TORRENT_UNUSED(ssl_context);
|
||||
#endif
|
||||
|
||||
if (sm)
|
||||
{
|
||||
utp_stream* str;
|
||||
|
|
|
@ -81,14 +81,14 @@ namespace libtorrent { namespace
|
|||
int size = (offset.first + offset.second) * 256 / total_size - start;
|
||||
|
||||
std::pair<int, int> ret(start, size);
|
||||
|
||||
|
||||
TORRENT_ASSERT(start >= 0);
|
||||
TORRENT_ASSERT(size > 0);
|
||||
TORRENT_ASSERT(start <= 256);
|
||||
TORRENT_ASSERT(start + size <= 256);
|
||||
|
||||
// assert the identity of this function
|
||||
#ifndef NDEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
std::pair<int, int> identity = req_to_offset(ret, total_size);
|
||||
TORRENT_ASSERT(offset == identity);
|
||||
#endif
|
||||
|
|
|
@ -5789,6 +5789,10 @@ namespace libtorrent
|
|||
if (free_space > 0)
|
||||
{
|
||||
char* dst = m_send_buffer.append(buf, free_space);
|
||||
|
||||
// this should always succeed, because we checked how much space
|
||||
// there was up-front
|
||||
TORRENT_UNUSED(dst);
|
||||
TORRENT_ASSERT(dst != 0);
|
||||
size -= free_space;
|
||||
buf += free_space;
|
||||
|
|
|
@ -834,7 +834,7 @@ namespace libtorrent
|
|||
erase_peer(i, state);
|
||||
}
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
else
|
||||
{
|
||||
#if TORRENT_USE_I2P
|
||||
|
|
|
@ -2354,7 +2354,7 @@ get_out:
|
|||
= TORRENT_ALLOCA(downloading_piece const*, partials_size);
|
||||
int c = 0;
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_ASSERTS && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
// if we get here, we're about to pick a busy block. First, make sure
|
||||
// we really exhausted the available blocks
|
||||
for (std::vector<downloading_piece>::const_iterator i
|
||||
|
@ -2402,7 +2402,7 @@ get_out:
|
|||
i != end; ++i)
|
||||
{
|
||||
if (c == partials_size) break;
|
||||
|
||||
|
||||
downloading_piece const& dp = *i;
|
||||
TORRENT_ASSERT(dp.requested > 0);
|
||||
// this peer doesn't have this piece, try again
|
||||
|
@ -2895,7 +2895,7 @@ get_out:
|
|||
if (int(i->finished) + int(i->writing) < max_blocks) return false;
|
||||
TORRENT_ASSERT(int(i->finished) + int(i->writing) == max_blocks);
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_ASSERTS && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
block_info const* info = blocks_for_piece(*i);
|
||||
for (int k = 0; k < max_blocks; ++k)
|
||||
{
|
||||
|
|
|
@ -622,7 +622,7 @@ namespace aux {
|
|||
|
||||
// this is called when one or all save resume alerts are
|
||||
// popped off the alert queue
|
||||
void session_impl::async_resume_dispatched(int num_popped_resume)
|
||||
void session_impl::async_resume_dispatched()
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ namespace aux {
|
|||
return num_copied;
|
||||
}
|
||||
|
||||
bool session_impl::use_quota_overhead(bandwidth_channel* ch, int channel, int amount)
|
||||
bool session_impl::use_quota_overhead(bandwidth_channel* ch, int amount)
|
||||
{
|
||||
ch->use_quota(amount);
|
||||
return (ch->throttle() > 0 && ch->throttle() < amount);
|
||||
|
@ -1509,11 +1509,12 @@ namespace aux {
|
|||
{
|
||||
peer_class* p = m_classes.at(set.class_at(i));
|
||||
if (p == 0) continue;
|
||||
|
||||
bandwidth_channel* ch = &p->channel[peer_connection::download_channel];
|
||||
if (use_quota_overhead(ch, peer_connection::download_channel, amount_down))
|
||||
if (use_quota_overhead(ch, amount_down))
|
||||
ret |= 1 << peer_connection::download_channel;
|
||||
ch = &p->channel[peer_connection::upload_channel];
|
||||
if (use_quota_overhead(ch, peer_connection::upload_channel, amount_up))
|
||||
if (use_quota_overhead(ch, amount_up))
|
||||
ret |= 1 << peer_connection::upload_channel;
|
||||
}
|
||||
return ret;
|
||||
|
@ -6177,7 +6178,7 @@ retry:
|
|||
// we can only issue more resume data jobs from
|
||||
// the network thread
|
||||
m_io_service.post(boost::bind(&session_impl::async_resume_dispatched
|
||||
, this, num_resume));
|
||||
, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7304,13 +7304,14 @@ namespace libtorrent
|
|||
pi.piece_index = i->index;
|
||||
queue->push_back(pi);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool torrent::connect_to_peer(torrent_peer* peerinfo, bool ignore_limit)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
INVARIANT_CHECK;
|
||||
TORRENT_UNUSED(ignore_limit);
|
||||
|
||||
TORRENT_ASSERT(peerinfo);
|
||||
TORRENT_ASSERT(peerinfo->connection == 0);
|
||||
|
@ -7318,7 +7319,7 @@ namespace libtorrent
|
|||
if (m_abort) return false;
|
||||
|
||||
peerinfo->last_connected = m_ses.session_time();
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
if (!settings().get_bool(settings_pack::allow_multiple_connections_per_ip))
|
||||
{
|
||||
// this asserts that we don't have duplicates in the peer_list's peer list
|
||||
|
@ -7333,7 +7334,7 @@ namespace libtorrent
|
|||
|| (*i_)->type() != peer_connection::bittorrent_connection);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif // TORRENT_USE_ASSERTS
|
||||
|
||||
TORRENT_ASSERT(want_peers() || ignore_limit);
|
||||
TORRENT_ASSERT(m_ses.num_connections()
|
||||
|
|
|
@ -501,6 +501,7 @@ namespace libtorrent { namespace
|
|||
int ret = bdecode(&pex_msg[0], &pex_msg[0] + pex_msg.size(), m, ec);
|
||||
TORRENT_ASSERT(ret == 0);
|
||||
TORRENT_ASSERT(!ec);
|
||||
TORRENT_UNUSED(ret);
|
||||
int num_dropped = 0;
|
||||
int num_added = 0;
|
||||
bdecode_node e = m.dict_find_string("added");
|
||||
|
|
|
@ -511,7 +511,7 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded() + bytes_transferred < size_t(INT_MAX));
|
||||
int dl_target = statistics().last_payload_downloaded()
|
||||
|
@ -525,11 +525,9 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
peer_log(peer_log_alert::info, "ERROR"
|
||||
, "web_peer_connection error: %s", error.message().c_str());
|
||||
#endif
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded()
|
||||
== dl_target);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -538,11 +536,9 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
|
||||
for (;;)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded() + int(bytes_transferred)
|
||||
== dl_target);
|
||||
#endif
|
||||
|
||||
buffer::const_interval recv_buffer = m_recv_buffer.get();
|
||||
|
||||
|
@ -565,28 +561,24 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
, "%s", std::string(recv_buffer.begin, recv_buffer.end).c_str());
|
||||
#endif
|
||||
disconnect(errors::http_parse_error, op_bittorrent, 2);
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded()
|
||||
== dl_target);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
TORRENT_ASSERT(recv_buffer.left() == 0 || *recv_buffer.begin == 'H');
|
||||
|
||||
|
||||
TORRENT_ASSERT(recv_buffer.left() <= m_recv_buffer.packet_size());
|
||||
|
||||
|
||||
// this means the entire status line hasn't been received yet
|
||||
if (m_parser.status_code() == -1)
|
||||
{
|
||||
TORRENT_ASSERT(payload == 0);
|
||||
TORRENT_ASSERT(bytes_transferred == 0);
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded() + int(bytes_transferred)
|
||||
== dl_target);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -594,11 +586,9 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
{
|
||||
TORRENT_ASSERT(payload == 0);
|
||||
TORRENT_ASSERT(bytes_transferred == 0);
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(statistics().last_payload_downloaded()
|
||||
+ statistics().last_protocol_downloaded() + int(bytes_transferred)
|
||||
== dl_target);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -314,6 +314,7 @@ int test_main()
|
|||
|
||||
// test identify_client
|
||||
|
||||
// TODO: 3 move testing of identify_client out to its own test
|
||||
TEST_EQUAL(identify_client(peer_id("-AZ123B-............")), "Azureus 1.2.3.11");
|
||||
TEST_EQUAL(identify_client(peer_id("-AZ1230-............")), "Azureus 1.2.3");
|
||||
TEST_EQUAL(identify_client(peer_id("S123--..............")), "Shadow 1.2.3");
|
||||
|
@ -337,7 +338,7 @@ int test_main()
|
|||
#endif
|
||||
TEST_CHECK(is_any(address_v4::any()));
|
||||
TEST_CHECK(!is_any(address::from_string("31.53.21.64", ec)));
|
||||
|
||||
|
||||
TEST_CHECK(match_addr_mask(
|
||||
address::from_string("10.0.1.176", ec),
|
||||
address::from_string("10.0.1.176", ec),
|
||||
|
|
Loading…
Reference in New Issue