support release asserts
This commit is contained in:
parent
aeb90205c7
commit
a73960aa5a
|
@ -190,7 +190,7 @@ namespace libtorrent
|
||||||
|
|
||||||
void incoming_connection(boost::shared_ptr<socket_type> const& s);
|
void incoming_connection(boost::shared_ptr<socket_type> const& s);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool is_network_thread() const
|
bool is_network_thread() const
|
||||||
{
|
{
|
||||||
#if defined BOOST_HAS_PTHREADS
|
#if defined BOOST_HAS_PTHREADS
|
||||||
|
@ -1008,7 +1008,7 @@ namespace libtorrent
|
||||||
// the main working thread
|
// the main working thread
|
||||||
boost::scoped_ptr<thread> m_thread;
|
boost::scoped_ptr<thread> m_thread;
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG && defined BOOST_HAS_PTHREADS
|
#if (defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS) && defined BOOST_HAS_PTHREADS
|
||||||
pthread_t m_network_thread;
|
pthread_t m_network_thread;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct TORRENT_EXPORT bandwidth_manager
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool is_queued(bandwidth_socket const* peer) const;
|
bool is_queued(bandwidth_socket const* peer) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ public:
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
|
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
|
||||||
m_RC4_handler->encrypt(buffer, size);
|
m_RC4_handler->encrypt(buffer, size);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes += size;
|
m_encrypted_bytes += size;
|
||||||
TORRENT_ASSERT(m_encrypted_bytes == send_buffer_size() + size);
|
TORRENT_ASSERT(m_encrypted_bytes == send_buffer_size() + size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -445,7 +445,7 @@ private:
|
||||||
boost::scoped_ptr<sha1_hash> m_sync_hash;
|
boost::scoped_ptr<sha1_hash> m_sync_hash;
|
||||||
#endif // #ifndef TORRENT_DISABLE_ENCRYPTION
|
#endif // #ifndef TORRENT_DISABLE_ENCRYPTION
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
// this is set to true when the client's
|
// this is set to true when the client's
|
||||||
// bitfield is sent to this peer
|
// bitfield is sent to this peer
|
||||||
bool m_sent_bitfield;
|
bool m_sent_bitfield;
|
||||||
|
|
|
@ -232,11 +232,11 @@ namespace libtorrent
|
||||||
struct TORRENT_EXPORT disk_buffer_pool : boost::noncopyable
|
struct TORRENT_EXPORT disk_buffer_pool : boost::noncopyable
|
||||||
{
|
{
|
||||||
disk_buffer_pool(int block_size);
|
disk_buffer_pool(int block_size);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
~disk_buffer_pool();
|
~disk_buffer_pool();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_DISK_STATS
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS || defined TORRENT_DISK_STATS
|
||||||
bool is_disk_buffer(char* buffer
|
bool is_disk_buffer(char* buffer
|
||||||
, mutex::scoped_lock& l) const;
|
, mutex::scoped_lock& l) const;
|
||||||
bool is_disk_buffer(char* buffer) const;
|
bool is_disk_buffer(char* buffer) const;
|
||||||
|
@ -296,7 +296,7 @@ namespace libtorrent
|
||||||
std::ofstream m_log;
|
std::ofstream m_log;
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int m_magic;
|
int m_magic;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct observer : boost::noncopyable
|
||||||
, flags(0)
|
, flags(0)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(a);
|
TORRENT_ASSERT(a);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_in_constructor = true;
|
m_in_constructor = true;
|
||||||
m_was_sent = false;
|
m_was_sent = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,7 +162,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool m_in_constructor:1;
|
bool m_in_constructor:1;
|
||||||
bool m_was_sent:1;
|
bool m_was_sent:1;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -88,8 +88,10 @@ public:
|
||||||
|
|
||||||
void add_our_id(entry& e);
|
void add_our_id(entry& e);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
size_t allocation_size() const;
|
size_t allocation_size() const;
|
||||||
|
#endif
|
||||||
|
#ifdef TORRENT_DEBUG
|
||||||
void check_invariant() const;
|
void check_invariant() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ namespace libtorrent
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
public:
|
public:
|
||||||
bool m_in_constructor:1;
|
bool m_in_constructor:1;
|
||||||
bool m_disconnect_started:1;
|
bool m_disconnect_started:1;
|
||||||
|
|
|
@ -144,9 +144,10 @@ namespace libtorrent
|
||||||
|
|
||||||
void set_seed(policy::peer* p, bool s);
|
void set_seed(policy::peer* p, bool s);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool has_connection(const peer_connection* p);
|
bool has_connection(const peer_connection* p);
|
||||||
|
#endif
|
||||||
|
#ifdef TORRENT_DEBUG
|
||||||
void check_invariant() const;
|
void check_invariant() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace libtorrent
|
||||||
void maybe_realloc_buffers(int which = 3);
|
void maybe_realloc_buffers(int which = 3);
|
||||||
bool maybe_clear_callback();
|
bool maybe_clear_callback();
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
#if defined BOOST_HAS_PTHREADS
|
#if defined BOOST_HAS_PTHREADS
|
||||||
mutable pthread_t m_thread;
|
mutable pthread_t m_thread;
|
||||||
#endif
|
#endif
|
||||||
|
@ -226,7 +226,7 @@ namespace libtorrent
|
||||||
// operations hanging on this socket
|
// operations hanging on this socket
|
||||||
int m_outstanding_ops;
|
int m_outstanding_ops;
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool m_started;
|
bool m_started;
|
||||||
int m_magic;
|
int m_magic;
|
||||||
int m_outstanding_when_aborted;
|
int m_outstanding_when_aborted;
|
||||||
|
|
|
@ -223,12 +223,12 @@ private:
|
||||||
, supports_specific_external(true)
|
, supports_specific_external(true)
|
||||||
, disabled(false)
|
, disabled(false)
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
magic = 1337;
|
magic = 1337;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
~rootdevice()
|
~rootdevice()
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(magic == 1337);
|
TORRENT_ASSERT(magic == 1337);
|
||||||
|
@ -264,7 +264,7 @@ private:
|
||||||
|
|
||||||
mutable boost::shared_ptr<http_connection> upnp_connection;
|
mutable boost::shared_ptr<http_connection> upnp_connection;
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int magic;
|
int magic;
|
||||||
#endif
|
#endif
|
||||||
void close() const
|
void close() const
|
||||||
|
|
|
@ -313,7 +313,7 @@ public:
|
||||||
ec = asio::error::would_block;
|
ec = asio::error::would_block;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
size_t buf_size = 0;
|
size_t buf_size = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ public:
|
||||||
using asio::buffer_cast;
|
using asio::buffer_cast;
|
||||||
using asio::buffer_size;
|
using asio::buffer_size;
|
||||||
add_read_buffer(buffer_cast<void*>(*i), buffer_size(*i));
|
add_read_buffer(buffer_cast<void*>(*i), buffer_size(*i));
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
buf_size += buffer_size(*i);
|
buf_size += buffer_size(*i);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace libtorrent
|
||||||
m_queued_bytes = 0;
|
m_queued_bytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool bandwidth_manager::is_queued(bandwidth_socket const* peer) const
|
bool bandwidth_manager::is_queued(bandwidth_socket const* peer) const
|
||||||
{
|
{
|
||||||
for (queue_t::const_iterator i = m_queue.begin()
|
for (queue_t::const_iterator i = m_queue.begin()
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace libtorrent
|
||||||
peer_log("*** bt_peer_connection");
|
peer_log("*** bt_peer_connection");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_in_constructor = false;
|
m_in_constructor = false;
|
||||||
m_encrypted_bytes = 0;
|
m_encrypted_bytes = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -174,7 +174,7 @@ namespace libtorrent
|
||||||
m_quota[upload_channel] = 80;
|
m_quota[upload_channel] = 80;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_in_constructor = false;
|
m_in_constructor = false;
|
||||||
m_encrypted_bytes = 0;
|
m_encrypted_bytes = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -446,7 +446,7 @@ namespace libtorrent
|
||||||
send_buf.begin);
|
send_buf.begin);
|
||||||
|
|
||||||
std::generate(send_buf.begin + dh_key_len, send_buf.end, std::rand);
|
std::generate(send_buf.begin + dh_key_len, send_buf.end, std::rand);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes += send_buf.left();
|
m_encrypted_bytes += send_buf.left();
|
||||||
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
||||||
#endif
|
#endif
|
||||||
|
@ -532,7 +532,7 @@ namespace libtorrent
|
||||||
|
|
||||||
write_pe_vc_cryptofield(send_buf, crypto_provide, pad_size);
|
write_pe_vc_cryptofield(send_buf, crypto_provide, pad_size);
|
||||||
m_RC4_handler->encrypt(send_buf.end - encrypt_size, encrypt_size);
|
m_RC4_handler->encrypt(send_buf.end - encrypt_size, encrypt_size);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes = send_buffer_size();
|
m_encrypted_bytes = send_buffer_size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ namespace libtorrent
|
||||||
|
|
||||||
m_RC4_handler->encrypt(send_buf.end - buf_size, buf_size);
|
m_RC4_handler->encrypt(send_buf.end - buf_size, buf_size);
|
||||||
TORRENT_ASSERT(send_buffer_size() - buf_size == m_encrypted_bytes);
|
TORRENT_ASSERT(send_buffer_size() - buf_size == m_encrypted_bytes);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes += buf_size;
|
m_encrypted_bytes += buf_size;
|
||||||
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
||||||
#endif
|
#endif
|
||||||
|
@ -683,7 +683,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(!m_rc4_encrypted || send_buffer_size() == m_encrypted_bytes);
|
TORRENT_ASSERT(!m_rc4_encrypted || send_buffer_size() == m_encrypted_bytes);
|
||||||
m_RC4_handler->encrypt(const_cast<char*>(buf), size);
|
m_RC4_handler->encrypt(const_cast<char*>(buf), size);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes += size;
|
m_encrypted_bytes += size;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_enc_send_buffer.end);
|
TORRENT_ASSERT(m_enc_send_buffer.end);
|
||||||
TORRENT_ASSERT(m_RC4_handler);
|
TORRENT_ASSERT(m_RC4_handler);
|
||||||
TORRENT_ASSERT(send_buffer_size() - m_enc_send_buffer.left() == m_encrypted_bytes);
|
TORRENT_ASSERT(send_buffer_size() - m_enc_send_buffer.left() == m_encrypted_bytes);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes += m_enc_send_buffer.left();
|
m_encrypted_bytes += m_enc_send_buffer.left();
|
||||||
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
TORRENT_ASSERT(m_encrypted_bytes <= send_buffer_size());
|
||||||
#endif
|
#endif
|
||||||
|
@ -2791,7 +2791,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_rc4_encrypted = true;
|
m_rc4_encrypted = true;
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_encrypted_bytes = send_buffer_size();
|
m_encrypted_bytes = send_buffer_size();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3364,7 +3364,7 @@ namespace libtorrent
|
||||||
std::remove_if(m_payloads.begin(), m_payloads.end(), range_below_zero)
|
std::remove_if(m_payloads.begin(), m_payloads.end(), range_below_zero)
|
||||||
, m_payloads.end());
|
, m_payloads.end());
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_ENCRYPTION
|
#if (defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS) && !defined TORRENT_DISABLE_ENCRYPTION
|
||||||
if (m_encrypted_bytes > 0)
|
if (m_encrypted_bytes > 0)
|
||||||
{
|
{
|
||||||
if (m_rc4_encrypted)
|
if (m_rc4_encrypted)
|
||||||
|
|
|
@ -86,12 +86,12 @@ namespace libtorrent
|
||||||
|
|
||||||
m_disk_access_log.open("disk_access.log", std::ios::trunc);
|
m_disk_access_log.open("disk_access.log", std::ios::trunc);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_magic = 0x1337;
|
m_magic = 0x1337;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
disk_buffer_pool::~disk_buffer_pool()
|
disk_buffer_pool::~disk_buffer_pool()
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_magic == 0x1337);
|
TORRENT_ASSERT(m_magic == 0x1337);
|
||||||
|
@ -99,7 +99,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_DISK_STATS
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS || defined TORRENT_DISK_STATS
|
||||||
bool disk_buffer_pool::is_disk_buffer(char* buffer
|
bool disk_buffer_pool::is_disk_buffer(char* buffer
|
||||||
, mutex::scoped_lock& l) const
|
, mutex::scoped_lock& l) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,12 +230,13 @@ void rpc_manager::free_observer(void* ptr)
|
||||||
m_pool_allocator.free(ptr);
|
m_pool_allocator.free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
size_t rpc_manager::allocation_size() const
|
size_t rpc_manager::allocation_size() const
|
||||||
{
|
{
|
||||||
return observer_size;
|
return observer_size;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef TORRENT_DEBUG
|
||||||
void rpc_manager::check_invariant() const
|
void rpc_manager::check_invariant() const
|
||||||
{
|
{
|
||||||
for (transactions_t::const_iterator i = m_transactions.begin()
|
for (transactions_t::const_iterator i = m_transactions.begin()
|
||||||
|
@ -470,7 +471,7 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
|
||||||
if (m_send(m_userdata, e, target_addr, 1))
|
if (m_send(m_userdata, e, target_addr, 1))
|
||||||
{
|
{
|
||||||
m_transactions.push_back(o);
|
m_transactions.push_back(o);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
o->m_was_sent = true;
|
o->m_was_sent = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -2287,7 +2287,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
pending_block pending_b = *b;
|
pending_block pending_b = *b;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace
|
||||||
tcp::endpoint const& m_ep;
|
tcp::endpoint const& m_ep;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
struct match_peer_connection
|
struct match_peer_connection
|
||||||
{
|
{
|
||||||
match_peer_connection(peer_connection const& c) : m_conn(c) {}
|
match_peer_connection(peer_connection const& c) : m_conn(c) {}
|
||||||
|
@ -1444,7 +1444,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
bool policy::has_connection(const peer_connection* c)
|
bool policy::has_connection(const peer_connection* c)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -1464,7 +1464,9 @@ namespace libtorrent
|
||||||
, m_peers.end()
|
, m_peers.end()
|
||||||
, match_peer_connection_or_endpoint(*c)) != m_peers.end();
|
, match_peer_connection_or_endpoint(*c)) != m_peers.end();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TORRENT_DEBUG
|
||||||
void policy::check_invariant() const
|
void policy::check_invariant() const
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_num_connect_candidates >= 0);
|
TORRENT_ASSERT(m_num_connect_candidates >= 0);
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ namespace aux {
|
||||||
// abort all connections
|
// abort all connections
|
||||||
while (!m_connections.empty())
|
while (!m_connections.empty())
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int conn = m_connections.size();
|
int conn = m_connections.size();
|
||||||
#endif
|
#endif
|
||||||
(*m_connections.begin())->disconnect(errors::stopping_torrent);
|
(*m_connections.begin())->disconnect(errors::stopping_torrent);
|
||||||
|
@ -4238,7 +4238,7 @@ namespace aux {
|
||||||
if (options & session::delete_files)
|
if (options & session::delete_files)
|
||||||
t.delete_files();
|
t.delete_files();
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
sha1_hash i_hash = t.torrent_file().info_hash();
|
sha1_hash i_hash = t.torrent_file().info_hash();
|
||||||
#endif
|
#endif
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
|
|
@ -326,7 +326,7 @@ namespace libtorrent
|
||||||
std::memset(i->iov_base, 0, i->iov_len);
|
std::memset(i->iov_base, 0, i->iov_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int count_bufs(file::iovec_t const* bufs, int bytes)
|
int count_bufs(file::iovec_t const* bufs, int bytes)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -1112,7 +1112,7 @@ ret:
|
||||||
int size = bufs_size(bufs, num_bufs);
|
int size = bufs_size(bufs, num_bufs);
|
||||||
TORRENT_ASSERT(size > 0);
|
TORRENT_ASSERT(size > 0);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
std::vector<file_slice> slices
|
std::vector<file_slice> slices
|
||||||
= files().map_block(slot, offset, size);
|
= files().map_block(slot, offset, size);
|
||||||
TORRENT_ASSERT(!slices.empty());
|
TORRENT_ASSERT(!slices.empty());
|
||||||
|
@ -1148,7 +1148,7 @@ ret:
|
||||||
|
|
||||||
TORRENT_ASSERT(bytes_left >= 0);
|
TORRENT_ASSERT(bytes_left >= 0);
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1169,7 +1169,7 @@ ret:
|
||||||
|
|
||||||
if (file_bytes_left == 0) continue;
|
if (file_bytes_left == 0) continue;
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
TORRENT_ASSERT(int(slices.size()) > counter);
|
TORRENT_ASSERT(int(slices.size()) > counter);
|
||||||
size_type slice_size = slices[counter].size;
|
size_type slice_size = slices[counter].size;
|
||||||
TORRENT_ASSERT(slice_size == file_bytes_left);
|
TORRENT_ASSERT(slice_size == file_bytes_left);
|
||||||
|
|
|
@ -610,7 +610,7 @@ namespace libtorrent
|
||||||
// update our torrent_info object and move the
|
// update our torrent_info object and move the
|
||||||
// torrent from the old info-hash to the new one
|
// torrent from the old info-hash to the new one
|
||||||
// as we replace the torrent_info object
|
// as we replace the torrent_info object
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int num_torrents = m_ses.m_torrents.size();
|
int num_torrents = m_ses.m_torrents.size();
|
||||||
#endif
|
#endif
|
||||||
// we're about to erase the session's reference to this
|
// we're about to erase the session's reference to this
|
||||||
|
@ -718,7 +718,7 @@ namespace libtorrent
|
||||||
// update our torrent_info object and move the
|
// update our torrent_info object and move the
|
||||||
// torrent from the old info-hash to the new one
|
// torrent from the old info-hash to the new one
|
||||||
// as we replace the torrent_info object
|
// as we replace the torrent_info object
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int num_torrents = m_ses.m_torrents.size();
|
int num_torrents = m_ses.m_torrents.size();
|
||||||
#endif
|
#endif
|
||||||
m_ses.m_torrents.erase(m_torrent_file->info_hash());
|
m_ses.m_torrents.erase(m_torrent_file->info_hash());
|
||||||
|
@ -5237,7 +5237,7 @@ namespace libtorrent
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
(*p->m_logger) << "*** CLOSING CONNECTION: " << ec.message() << "\n";
|
(*p->m_logger) << "*** CLOSING CONNECTION: " << ec.message() << "\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
std::size_t size = m_connections.size();
|
std::size_t size = m_connections.size();
|
||||||
#endif
|
#endif
|
||||||
if (p->is_disconnecting())
|
if (p->is_disconnecting())
|
||||||
|
@ -5308,7 +5308,7 @@ namespace libtorrent
|
||||||
peer_connection* p = *i;
|
peer_connection* p = *i;
|
||||||
++ret;
|
++ret;
|
||||||
TORRENT_ASSERT(p->associated_torrent().lock().get() == this);
|
TORRENT_ASSERT(p->associated_torrent().lock().get() == this);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
int num_conns = m_connections.size();
|
int num_conns = m_connections.size();
|
||||||
#endif
|
#endif
|
||||||
p->disconnect(ec);
|
p->disconnect(ec);
|
||||||
|
|
|
@ -82,7 +82,7 @@ udp_socket::udp_socket(asio::io_service& ios
|
||||||
, m_abort(false)
|
, m_abort(false)
|
||||||
, m_outstanding_ops(0)
|
, m_outstanding_ops(0)
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_magic = 0x1337;
|
m_magic = 0x1337;
|
||||||
m_started = false;
|
m_started = false;
|
||||||
m_outstanding_when_aborted = -1;
|
m_outstanding_when_aborted = -1;
|
||||||
|
@ -109,13 +109,13 @@ udp_socket::~udp_socket()
|
||||||
TORRENT_ASSERT_VAL(m_v4_outstanding == 0, m_v4_outstanding);
|
TORRENT_ASSERT_VAL(m_v4_outstanding == 0, m_v4_outstanding);
|
||||||
TORRENT_ASSERT(m_magic == 0x1337);
|
TORRENT_ASSERT(m_magic == 0x1337);
|
||||||
TORRENT_ASSERT(!m_callback || !m_started);
|
TORRENT_ASSERT(!m_callback || !m_started);
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_magic = 0;
|
m_magic = 0;
|
||||||
#endif
|
#endif
|
||||||
TORRENT_ASSERT(m_outstanding_ops == 0);
|
TORRENT_ASSERT(m_outstanding_ops == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
#define CHECK_MAGIC check_magic_ cm_(m_magic)
|
#define CHECK_MAGIC check_magic_ cm_(m_magic)
|
||||||
struct check_magic_
|
struct check_magic_
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue