forked from premiere/premiere-libtorrent
clean-up more defines (#872)
clean-up more defines. remove TORRENT_DEBUG and TORRENT_DISABLE_INVARIANT_CHECKS (instead use TORRENT_USE_ASSERTS and TORRENT_USE_INVARIANT_CHECKS)
This commit is contained in:
parent
afed2a8f40
commit
1facf0eef6
35
Jamfile
35
Jamfile
|
@ -113,8 +113,7 @@ rule linking ( properties * )
|
|||
}
|
||||
|
||||
if <target-os>windows in $(properties)
|
||||
&& ( <define>TORRENT_DEBUG
|
||||
|| <asserts>on in $(properties)
|
||||
&& ( <asserts>on in $(properties)
|
||||
|| <asserts>production in $(properties)
|
||||
|| <pool-allocators>debug in $(properties)
|
||||
|| <allocator>debug in $(properties)
|
||||
|
@ -415,11 +414,10 @@ feature.compose <iconv>off : <define>TORRENT_USE_ICONV=0 ;
|
|||
feature memory-optimization : off on : composite propagated link-incompatible ;
|
||||
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;
|
||||
|
||||
feature asserts : auto on off production system : composite propagated ;
|
||||
feature asserts : off on production system : composite propagated ;
|
||||
feature.compose <asserts>on : <define>TORRENT_USE_ASSERTS=1 ;
|
||||
feature.compose <asserts>production : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_PRODUCTION_ASSERTS=1 ;
|
||||
feature.compose <asserts>system : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_USE_SYSTEM_ASSERTS=1 ;
|
||||
feature.compose <asserts>off : <define>TORRENT_USE_ASSERTS=0 ;
|
||||
|
||||
feature windows-version : vista win7 xp : composite propagated link-incompatible ;
|
||||
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
|
||||
|
@ -451,9 +449,9 @@ feature piece-allocator : valloc memalign posix_memalign : composite propagated
|
|||
feature.compose <piece-allocator>memalign : <define>TORRENT_USE_MEMALIGN=1 ;
|
||||
feature.compose <piece-allocator>posix_memalign : <define>TORRENT_USE_POSIX_MEMALIGN=1 ;
|
||||
|
||||
feature invariant-checks : on off full : composite propagated link-incompatible ;
|
||||
feature.compose <invariant-checks>off : <define>TORRENT_DISABLE_INVARIANT_CHECKS ;
|
||||
feature.compose <invariant-checks>full : <define>TORRENT_EXPENSIVE_INVARIANT_CHECKS ;
|
||||
feature invariant-checks : off on full : composite propagated link-incompatible ;
|
||||
feature.compose <invariant-checks>on : <define>TORRENT_USE_INVARIANT_CHECKS=1 ;
|
||||
feature.compose <invariant-checks>full : <define>TORRENT_USE_INVARIANT_CHECKS=1 <define>TORRENT_EXPENSIVE_INVARIANT_CHECKS ;
|
||||
|
||||
feature disk-stats : off on : composite propagated link-incompatible ;
|
||||
feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;
|
||||
|
@ -513,25 +511,25 @@ feature export-extra : off on : composite propagated ;
|
|||
# allowed memory usage on travis-ci
|
||||
variant test_release : release
|
||||
: <asserts>production <debug-symbols>on
|
||||
<invariant-checks>full <boost-link>shared <optimization>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi
|
||||
<inlining>off
|
||||
<invariant-checks>full <boost-link>shared <optimization>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi
|
||||
<inlining>off
|
||||
;
|
||||
variant test_debug : debug
|
||||
: <ssl>openssl <crypto>libcrypto <logging>on <disk-stats>on
|
||||
<allocator>debug
|
||||
<invariant-checks>full <boost-link>shared
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
<allocator>debug
|
||||
<invariant-checks>full <boost-link>shared
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
;
|
||||
variant test_barebones : debug
|
||||
: <ipv6>off <dht>off <extensions>off <logging>off <boost-link>shared
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
;
|
||||
variant test_arm : debug
|
||||
: <ipv6>off <dht>off <extensions>off <logging>off
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <asserts>on
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <asserts>on
|
||||
;
|
||||
|
||||
# required for openssl on windows
|
||||
|
@ -726,7 +724,6 @@ local usage-requirements =
|
|||
# and iconv.h is installed there
|
||||
<include>/usr/local/include
|
||||
<variant>release:<define>NDEBUG
|
||||
<variant>debug:<define>TORRENT_DEBUG
|
||||
<define>_FILE_OFFSET_BITS=64
|
||||
<define>BOOST_EXCEPTION_DISABLE
|
||||
# enable cancel support in asio
|
||||
|
@ -767,6 +764,8 @@ lib torrent
|
|||
|
||||
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
|
||||
<variant>debug:<asserts>on
|
||||
<variant>debug:<invariant-checks>on
|
||||
|
||||
<conditional>@building
|
||||
<conditional>@warnings
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -312,7 +312,7 @@ AC_MSG_CHECKING([whether debug build should be enabled])
|
|||
AS_CASE(["$ARG_ENABLE_DEBUG"],
|
||||
["yes"], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([TORRENT_DEBUG],[1],[Define to enable debug code.])
|
||||
AC_DEFINE([TORRENT_USE_ASSERTS],[1],[Define to enable debug code.])
|
||||
COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DTORRENT_DEBUG "
|
||||
DEBUGFLAGS="-g"
|
||||
],
|
||||
|
@ -330,19 +330,16 @@ AC_MSG_CHECKING([whether invariant check should be enabled]) #depends: $ac_arg_e
|
|||
AS_CASE(["$ARG_ENABLE_INVARIANT"],
|
||||
["yes"|"on"], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AS_IF([test "x$ac_arg_enable_debug" = "xno"],
|
||||
[AC_MSG_ERROR([invariant-checks: this setting only affects debug build. Try using --enable-debug.])])
|
||||
[AC_DEFINE([TORRENT_USE_INVARIANT_CHECKS],[1],[Define to enable internal invariant checks.])])
|
||||
],
|
||||
["no"|"off"], [
|
||||
AC_MSG_RESULT([no])
|
||||
AS_IF([test "x$ac_arg_enable_debug" = "xyes"],
|
||||
[AC_DEFINE([TORRENT_DISABLE_INVARIANT_CHECKS],[1],[Define to disable internal invariant checks. Asserts are still enabled while debug is on.])])
|
||||
[AC_DEFINE([TORRENT_USE_INVARIANT_CHECKS],[0],[Define to disable internal invariant checks. Asserts are still enabled while debug is on.])])
|
||||
],
|
||||
["full"], [
|
||||
AC_MSG_RESULT([full])
|
||||
AS_IF([test "x$ac_arg_enable_debug" = "xyes"],
|
||||
[AC_DEFINE([TORRENT_EXPENSIVE_INVARIANT_CHECKS],[1],[Define to enable extra expensive invariant checks.])],
|
||||
[AC_MSG_ERROR([invariant-checks: this setting only affects debug build. Try using --enable-debug.])])
|
||||
[AC_DEFINE([TORRENT_USE_INVARIANT_CHECKS],[1],[Define to enable internal invariant checks.])])
|
||||
[AC_DEFINE([TORRENT_EXPENSIVE_INVARIANT_CHECKS],[1],[Define to enable extra expensive invariant checks.])],
|
||||
],
|
||||
[AC_MSG_RESULT([$ARG_ENABLE_INVARIANT])
|
||||
AC_MSG_ERROR([Unknown option "$ARG_ENABLE_INVARIANT". Use either "yes", "no" or "full".])]
|
||||
|
|
|
@ -584,12 +584,11 @@ defines you can use to control the build.
|
|||
| | use wide character API, to properly support |
|
||||
| | non-ansi characters. |
|
||||
+----------------------------------------+-------------------------------------------------+
|
||||
| ``TORRENT_DISABLE_INVARIANT_CHECKS`` | This will disable internal invariant checks in |
|
||||
| | libtorrent. The invariant checks can sometime |
|
||||
| ``TORRENT_USE_INVARIANT_CHECKS`` | If defined to non-zero, this will enable |
|
||||
| | internal invariant checks in libtorrent. |
|
||||
| | The invariant checks can sometimes |
|
||||
| | be quite expensive, they typically don't scale |
|
||||
| | very well. This option can be used to still |
|
||||
| | build in debug mode, with asserts enabled, but |
|
||||
| | make the resulting executable faster. |
|
||||
| | very well. |
|
||||
+----------------------------------------+-------------------------------------------------+
|
||||
| ``TORRENT_EXPENSIVE_INVARIANT_CHECKS`` | This will enable extra expensive invariant |
|
||||
| | checks. Useful for finding particular bugs |
|
||||
|
|
|
@ -532,33 +532,26 @@ def consume_ifdef(lno, lines, warn_on_ifdefs = False):
|
|||
|
||||
if verbose: print 'prep %s' % l
|
||||
|
||||
if warn_on_ifdefs and ('TORRENT_DEBUG' in l):
|
||||
if warn_on_ifdefs and l.strip().startswith('#if'):
|
||||
while l.endswith('\\'):
|
||||
lno += 1
|
||||
l += lines[lno].strip()
|
||||
if verbose: print 'prep %s' % lines[lno].trim()
|
||||
define = trim_define(l)
|
||||
print '\x1b[31mWARNING: possible ABI breakage in public struct! "%s" \x1b[34m %s:%d\x1b[0m' % \
|
||||
(define, filename, lno)
|
||||
# we've already warned once, no need to do it twice
|
||||
warn_on_ifdefs = False
|
||||
|
||||
if warn_on_ifdefs and '#if' in l:
|
||||
while l.endswith('\\'):
|
||||
lno += 1
|
||||
l += lines[lno].strip()
|
||||
if verbose: print 'prep %s' % lines[lno].trim()
|
||||
define = trim_define(l)
|
||||
if define != '':
|
||||
if 'TORRENT_' in define:
|
||||
print '\x1b[31mWARNING: possible ABI breakage in public struct! "%s" \x1b[34m %s:%d\x1b[0m' % \
|
||||
(define, filename, lno)
|
||||
# we've already warned once, no need to do it twice
|
||||
warn_on_ifdefs = False
|
||||
elif define != '':
|
||||
print '\x1b[33msensitive define in public struct: "%s"\x1b[34m %s:%d\x1b[0m' % (define, filename, lno)
|
||||
|
||||
if l == '#ifndef TORRENT_NO_DEPRECATE' or \
|
||||
l == '#ifdef TORRENT_DEBUG' or \
|
||||
(l.startswith('#if ') and ' TORRENT_USE_ASSERTS' in l) or \
|
||||
(l.startswith('#if ') and ' TORRENT_USE_INVARIANT_CHECKS' in l) or \
|
||||
l == '#ifdef TORRENT_ASIO_DEBUGGING' or \
|
||||
(l.startswith('#if') and 'defined TORRENT_DEBUG' in l) or \
|
||||
(l.startswith('#if') and 'defined TORRENT_ASIO_DEBUGGING' in l):
|
||||
if (l.startswith('#if') and (
|
||||
' TORRENT_USE_ASSERTS' in l or
|
||||
' TORRENT_USE_INVARIANT_CHECKS' in l or
|
||||
' TORRENT_ASIO_DEBUGGING' in l) or
|
||||
l == '#ifndef TORRENT_NO_DEPRECATE'
|
||||
):
|
||||
while lno < len(lines):
|
||||
l = lines[lno].strip()
|
||||
lno += 1
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/export.hpp"
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
#include "libtorrent/bitfield.hpp"
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#endif
|
||||
|
@ -75,7 +75,7 @@ namespace aux
|
|||
// is first queried by the client
|
||||
std::vector<std::uint64_t> m_file_progress;
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
friend class libtorrent::invariant_access;
|
||||
void check_invariant() const;
|
||||
|
||||
|
|
|
@ -473,17 +473,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
// builds have asserts if they are explicitly enabled by
|
||||
// the release_asserts macro.
|
||||
#ifndef TORRENT_USE_ASSERTS
|
||||
#if defined TORRENT_DEBUG
|
||||
#define TORRENT_USE_ASSERTS 1
|
||||
#else
|
||||
#define TORRENT_USE_ASSERTS 0
|
||||
#endif
|
||||
#endif // TORRENT_USE_ASSERTS
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_ASSERTS \
|
||||
&& !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#define TORRENT_USE_INVARIANT_CHECKS 1
|
||||
#else
|
||||
#ifndef TORRENT_USE_INVARIANT_CHECKS
|
||||
#define TORRENT_USE_INVARIANT_CHECKS 0
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/pool/pool.hpp>
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
#include <set>
|
||||
#endif
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace libtorrent
|
|||
// this is specifically exempt from release_asserts
|
||||
// since it's a quite costly check. Only for debug
|
||||
// builds.
|
||||
#if defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
std::set<char*> m_buffers_in_use;
|
||||
#endif
|
||||
#if TORRENT_USE_ASSERTS
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace libtorrent
|
|||
struct TORRENT_DEPRECATED_EXPORT internal_file_entry
|
||||
{
|
||||
friend class file_storage;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
// for torrent_info::invariant_check
|
||||
friend class torrent_info;
|
||||
#endif
|
||||
|
|
|
@ -132,7 +132,8 @@ public:
|
|||
int data_size() const { return int(m_storage.num_torrents()); }
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
// TODO: 3 make this print to the DHT logger instead
|
||||
void print_state(std::ostream& os) const
|
||||
{ m_table.print_state(os); }
|
||||
#endif
|
||||
|
|
|
@ -162,7 +162,7 @@ private:
|
|||
// the transaction ID for this call
|
||||
std::uint16_t m_transaction_id;
|
||||
public:
|
||||
unsigned char flags;
|
||||
std::uint8_t flags;
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
bool m_in_constructor:1;
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
|
||||
void replacement_cache(bucket_t& nodes) const;
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
// used for debug and monitoring purposes. This will print out
|
||||
// the state of the routing table to the given stream
|
||||
void print_state(std::ostream& os) const;
|
||||
|
|
|
@ -600,10 +600,6 @@ namespace libtorrent
|
|||
int check_no_fastresume(storage_error& error);
|
||||
int check_init_storage(storage_error& error);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
std::string name() const { return m_files.name(); }
|
||||
#endif
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
void check_invariant() const;
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@ project
|
|||
<threading>multi
|
||||
<invariant-checks>full
|
||||
<debug-iterators>on
|
||||
<asserts>on
|
||||
<picker-debugging>on
|
||||
;
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ struct dht_node final : lt::dht::udp_socket_interface
|
|||
if (nodes_per_bucket[bucket] == 0) continue;
|
||||
--nodes_per_bucket[bucket];
|
||||
bool const added = dht().m_table.node_seen(n.first, n.second, (lt::random() % 300) + 10);
|
||||
TORRENT_ASSERT(added);
|
||||
TEST_CHECK(added);
|
||||
if (m_add_dead_nodes)
|
||||
{
|
||||
// generate a random node ID that would fall in `bucket`
|
||||
|
|
|
@ -558,7 +558,7 @@ void block_cache::try_evict_one_volatile()
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -601,7 +601,7 @@ void block_cache::try_evict_one_volatile()
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1075,7 +1075,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1115,7 +1115,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1148,7 +1148,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
@ -1194,7 +1194,7 @@ int block_cache::try_evict_blocks(int num, cached_piece_entry* ignore)
|
|||
|
||||
if (pe->ok_to_evict())
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (int j = 0; j < pe->blocks_in_piece; ++j)
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[j].buf == 0, pe);
|
||||
#endif
|
||||
|
|
|
@ -57,10 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
|
@ -212,13 +208,6 @@ namespace libtorrent
|
|||
|
||||
#endif
|
||||
open_multicast_socket(ios, i->interface_address, loopback, ec);
|
||||
#ifdef TORRENT_DEBUG
|
||||
std::fprintf(stderr, "broadcast socket [ if: %s group: %s mask: %s ] %s\n"
|
||||
, i->interface_address.to_string().c_str()
|
||||
, m_multicast_endpoint.address().to_string().c_str()
|
||||
, i->netmask.to_string().c_str()
|
||||
, ec.message().c_str());
|
||||
#endif
|
||||
open_unicast_socket(ios, i->interface_address
|
||||
, i->netmask.is_v4() ? i->netmask.to_v4() : address_v4());
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
return m_buffers_in_use.count(buffer) == 1;
|
||||
#elif defined TORRENT_DEBUG_BUFFERS
|
||||
return page_aligned_allocator::in_use(buffer);
|
||||
|
@ -310,7 +310,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
TORRENT_ASSERT(m_buffers_in_use.count(ret) == 0);
|
||||
m_buffers_in_use.insert(ret);
|
||||
#endif
|
||||
|
@ -553,7 +553,7 @@ namespace libtorrent
|
|||
#endif // TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
std::set<char*>::iterator i = m_buffers_in_use.find(buf);
|
||||
TORRENT_ASSERT(i != m_buffers_in_use.end());
|
||||
m_buffers_in_use.erase(i);
|
||||
|
|
|
@ -321,11 +321,9 @@ done:
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
static_assert((libtorrent::file::rw_mask & libtorrent::file::sparse) == 0, "internal flags error");
|
||||
static_assert((libtorrent::file::rw_mask & libtorrent::file::attribute_mask) == 0, "internal flags error");
|
||||
static_assert((libtorrent::file::sparse & libtorrent::file::attribute_mask) == 0, "internal flags error");
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_WINDOWS && defined UNICODE && !TORRENT_USE_WSTRING
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace libtorrent { namespace aux
|
|||
int const num_pieces = fs.num_pieces();
|
||||
int const num_files = fs.num_files();
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
m_have_pieces.clear();
|
||||
m_have_pieces.resize(num_pieces, false);
|
||||
m_file_sizes.clear();
|
||||
|
@ -87,7 +87,7 @@ namespace libtorrent { namespace aux
|
|||
|
||||
if (!picker.have_piece(piece)) continue;
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
m_have_pieces.set_bit(piece);
|
||||
#endif
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace libtorrent { namespace aux
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
std::vector<std::uint64_t>().swap(m_file_progress);
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
m_have_pieces.clear();
|
||||
#endif
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ namespace libtorrent { namespace aux
|
|||
INVARIANT_CHECK;
|
||||
if (m_file_progress.empty()) return;
|
||||
|
||||
#if TORRENT_USE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
// if this assert fires, we've told the file_progress object that we have
|
||||
// a piece twice. That violates its precondition and will cause incorect
|
||||
// accounting
|
||||
|
|
|
@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/ip_filter.hpp"
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -75,7 +73,7 @@ namespace libtorrent
|
|||
return m_filter4.export_filter<address_v4>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void port_filter::add_rule(std::uint16_t first, std::uint16_t last, std::uint32_t flags)
|
||||
{
|
||||
m_filter.add_rule(first, last, flags);
|
||||
|
|
|
@ -330,18 +330,6 @@ namespace libtorrent { namespace dht
|
|||
m_storage.update_node_ids(ids);
|
||||
}
|
||||
|
||||
/*
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
std::ofstream st("dht_routing_table_state.txt", std::ios_base::trunc);
|
||||
m_dht.print_state(st);
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
std::ofstream st6("dht6_routing_table_state.txt", std::ios_base::trunc);
|
||||
m_dht6.print_state(st6);
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
void dht_tracker::get_peers(sha1_hash const& ih
|
||||
, boost::function<void(std::vector<tcp::endpoint> const&)> f)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstdio> // for snprintf
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
#include "libtorrent/bdecode.hpp"
|
||||
#endif
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace
|
|||
, std::pair<char const*, int> salt, char out[canonical_length])
|
||||
{
|
||||
// v must be valid bencoding!
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
bdecode_node e;
|
||||
error_code ec;
|
||||
TORRENT_ASSERT(bdecode(v.first, v.first + v.second, e, ec) == 0);
|
||||
|
|
|
@ -242,8 +242,7 @@ int routing_table::depth() const
|
|||
return m_depth;
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
void routing_table::print_state(std::ostream& os) const
|
||||
{
|
||||
std::vector<char> buf(2048);
|
||||
|
|
|
@ -4315,7 +4315,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_request_queue.empty());
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
#if defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
// since this connection doesn't have a torrent reference
|
||||
// no torrent should have a reference to this connection either
|
||||
TORRENT_ASSERT(!m_ses.any_torrent_has_peer(this));
|
||||
|
|
|
@ -54,10 +54,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/ip_filter.hpp"
|
||||
#include "libtorrent/torrent_peer_allocator.hpp"
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
#endif
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
#include "libtorrent/socket_io.hpp" // for print_endpoint
|
||||
#endif
|
||||
|
@ -88,7 +84,7 @@ namespace
|
|||
tcp::endpoint const& m_ep;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
struct match_peer_connection
|
||||
{
|
||||
match_peer_connection(peer_connection_interface const& c) : m_conn(c) {}
|
||||
|
@ -1195,7 +1191,7 @@ namespace libtorrent
|
|||
|
||||
TORRENT_ASSERT(p->in_use);
|
||||
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
// web seeds are special, they're not connected via the peer list
|
||||
// so they're not kept in m_peers
|
||||
TORRENT_ASSERT(p->web_seed
|
||||
|
@ -1308,8 +1304,7 @@ namespace libtorrent
|
|||
int connect_candidates = 0;
|
||||
|
||||
const_iterator prev = m_peers.end();
|
||||
for (const_iterator i = m_peers.begin();
|
||||
i != m_peers.end(); ++i)
|
||||
for (const_iterator i = m_peers.begin(); i != m_peers.end(); ++i)
|
||||
{
|
||||
if (prev != m_peers.end()) ++prev;
|
||||
if (i == m_peers.begin() + 1) prev = m_peers.begin();
|
||||
|
@ -1339,7 +1334,7 @@ namespace libtorrent
|
|||
#endif // TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
|
||||
}
|
||||
#endif // TORRENT_DEBUG
|
||||
#endif
|
||||
|
||||
// this returns true if lhs is a better erase candidate than rhs
|
||||
bool peer_list::compare_peer_erase(torrent_peer const& lhs, torrent_peer const& rhs) const
|
||||
|
|
|
@ -317,7 +317,6 @@ namespace libtorrent
|
|||
|
||||
void piece_picker::check_piece_state() const
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
for (int k = 0; k < piece_pos::num_download_categories; ++k)
|
||||
{
|
||||
if (!m_downloads[k].empty())
|
||||
|
@ -327,7 +326,6 @@ namespace libtorrent
|
|||
{
|
||||
downloading_piece const& dp = *i;
|
||||
downloading_piece const& next = *(i + 1);
|
||||
// TORRENT_ASSERT(dp.finished + dp.writing >= next.finished + next.writing);
|
||||
TORRENT_ASSERT(dp.index < next.index);
|
||||
TORRENT_ASSERT(int(dp.info_idx) * m_blocks_per_piece
|
||||
+ m_blocks_per_piece <= int(m_block_info.size()));
|
||||
|
@ -345,7 +343,6 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void piece_picker::verify_pick(std::vector<piece_block> const& picked
|
||||
|
@ -2321,7 +2318,7 @@ get_out:
|
|||
= TORRENT_ALLOCA(downloading_piece const*, partials_size);
|
||||
int c = 0;
|
||||
|
||||
#if TORRENT_USE_ASSERTS && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_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
|
||||
|
@ -2424,7 +2421,7 @@ get_out:
|
|||
--partials_size;
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
// make sure that we at this point have added requests to all unrequested blocks
|
||||
// in all downloading pieces
|
||||
|
||||
|
@ -2491,7 +2488,7 @@ get_out:
|
|||
if (k == m_downloads[download_state].end()) continue;
|
||||
}
|
||||
}
|
||||
#endif // TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2848,7 +2845,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 TORRENT_USE_ASSERTS && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
block_info const* info = blocks_for_piece(*i);
|
||||
for (int k = 0; k < max_blocks; ++k)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ void receive_buffer::cut(int const size, int const packet_size, int const offset
|
|||
m_recv_pos -= size;
|
||||
m_recv_end -= size;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
std::fill(m_recv_buffer.begin() + m_recv_end, m_recv_buffer.end(), 0xcc);
|
||||
#endif
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void receive_buffer::normalize(int force_shrink)
|
|||
m_recv_end -= m_recv_start;
|
||||
m_recv_start = 0;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
std::fill(m_recv_buffer.begin() + m_recv_end, m_recv_buffer.end(), 0xcc);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace libtorrent
|
|||
// the number of blocks we want, but it will try to make the picked
|
||||
// blocks be from whole pieces, possibly by returning more blocks
|
||||
// than we requested.
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
error_code ec;
|
||||
TORRENT_ASSERT(c.remote() == c.get_socket()->remote_endpoint(ec) || ec);
|
||||
#endif
|
||||
|
@ -231,7 +231,7 @@ namespace libtorrent
|
|||
if (std::find_if(dq.begin(), dq.end(), has_block(*i)) != dq.end()
|
||||
|| std::find_if(rq.begin(), rq.end(), has_block(*i)) != rq.end())
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
std::vector<pending_block>::const_iterator j
|
||||
= std::find_if(dq.begin(), dq.end(), has_block(*i));
|
||||
if (j != dq.end()) TORRENT_ASSERT(j->timed_out || j->not_wanted);
|
||||
|
@ -272,7 +272,7 @@ namespace libtorrent
|
|||
// and can't find any, that doesn't count as end-game
|
||||
if (!c.has_peer_choked())
|
||||
c.set_endgame(true);
|
||||
|
||||
|
||||
// if we don't have any potential busy blocks to request
|
||||
// or if we already have outstanding requests, don't
|
||||
// pick a busy piece
|
||||
|
@ -282,7 +282,7 @@ namespace libtorrent
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
piece_picker::downloading_piece st;
|
||||
p.piece_info(busy_block.piece_index, st);
|
||||
TORRENT_ASSERT(st.requested + st.finished + st.writing
|
||||
|
|
|
@ -40,9 +40,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cinttypes> // for PRId64 et.al.
|
||||
#include <functional>
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
#include <unordered_set>
|
||||
#endif // TORRENT_DEBUG && !TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ namespace aux {
|
|||
TORRENT_ASSERT(pc);
|
||||
if (pc == 0)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
// make it obvious that the return value is undefined
|
||||
ret.upload_limit = 0xf0f0f0f;
|
||||
ret.download_limit = 0xf0f0f0f;
|
||||
|
@ -1229,7 +1229,7 @@ namespace aux {
|
|||
// checking to see if it's the first item
|
||||
if (t->next != nullptr || t->prev != nullptr || m_torrent_lru.front() == t)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
torrent* i = m_torrent_lru.front();
|
||||
while (i != nullptr && i != t) i = i->next;
|
||||
TORRENT_ASSERT(i == t);
|
||||
|
@ -1269,7 +1269,7 @@ namespace aux {
|
|||
|
||||
TORRENT_ASSERT(t->next != nullptr || t->prev != nullptr || m_torrent_lru.front() == t);
|
||||
|
||||
#if defined TORRENT_DEBUG && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_ASSERTS
|
||||
torrent* i = m_torrent_lru.front();
|
||||
while (i != nullptr && i != t) i = i->next;
|
||||
TORRENT_ASSERT(i == t);
|
||||
|
@ -1308,7 +1308,7 @@ namespace aux {
|
|||
// one more torrent in the list.
|
||||
if (ignore->next != nullptr || ignore->prev != nullptr || m_torrent_lru.front() == ignore)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
torrent* i = m_torrent_lru.front();
|
||||
while (i != nullptr && i != ignore) i = i->next;
|
||||
TORRENT_ASSERT(i == ignore);
|
||||
|
@ -2866,15 +2866,6 @@ namespace aux {
|
|||
if (!sp.unique())
|
||||
m_undead_peers.push_back(sp);
|
||||
|
||||
// too expensive
|
||||
// INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
// for (aux::session_impl::torrent_map::const_iterator i = m_torrents.begin()
|
||||
// , end(m_torrents.end()); i != end; ++i)
|
||||
// TORRENT_ASSERT(!i->second->has_peer((peer_connection*)p));
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
session_log(" CLOSING CONNECTION %s : %s"
|
||||
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
|
||||
|
@ -4246,7 +4237,7 @@ namespace aux {
|
|||
TORRENT_ASSERT(is_single_thread());
|
||||
|
||||
torrent_map::const_iterator i = m_torrents.find(info_hash);
|
||||
#if defined TORRENT_DEBUG && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
for (torrent_map::const_iterator j
|
||||
= m_torrents.begin(); j != m_torrents.end(); ++j)
|
||||
{
|
||||
|
|
|
@ -3866,11 +3866,9 @@ namespace libtorrent
|
|||
{
|
||||
downloading_piece[block] = p->bytes_downloaded;
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
TORRENT_ASSERT(p->bytes_downloaded <= p->full_block_bytes);
|
||||
TORRENT_ASSERT(p->full_block_bytes == to_req(piece_block(
|
||||
p->piece_index, p->block_index)).length);
|
||||
#endif
|
||||
}
|
||||
for (std::map<piece_block, int>::iterator i = downloading_piece.begin();
|
||||
i != downloading_piece.end(); ++i)
|
||||
|
@ -3884,7 +3882,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(st.total_done <= m_torrent_file->total_size() - m_padding);
|
||||
TORRENT_ASSERT(st.total_wanted_done <= m_torrent_file->total_size() - m_padding);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
|
||||
if (st.total_done >= m_torrent_file->total_size())
|
||||
{
|
||||
|
@ -4296,7 +4294,7 @@ namespace libtorrent
|
|||
std::set<torrent_peer*> peers;
|
||||
std::copy(downloaders.begin(), downloaders.end(), std::inserter(peers, peers.begin()));
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
for (std::vector<torrent_peer*>::iterator i = downloaders.begin()
|
||||
, end(downloaders.end()); i != end; ++i)
|
||||
{
|
||||
|
@ -4414,7 +4412,7 @@ namespace libtorrent
|
|||
on_piece_sync(&j);
|
||||
}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
for (std::vector<torrent_peer*>::iterator i = downloaders.begin()
|
||||
, end(downloaders.end()); i != end; ++i)
|
||||
{
|
||||
|
@ -4494,12 +4492,10 @@ namespace libtorrent
|
|||
torrent_peer* pp = peer->peer_info_struct();
|
||||
m_picker->inc_refcount(index, pp);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(is_seed() || !m_have_all);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// when we get a bitfield message, this is called for that piece
|
||||
|
@ -4511,12 +4507,10 @@ namespace libtorrent
|
|||
torrent_peer* pp = peer->peer_info_struct();
|
||||
m_picker->inc_refcount(bits, pp);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(is_seed() || !m_have_all);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void torrent::peer_has_all(peer_connection const* peer)
|
||||
|
@ -4526,12 +4520,10 @@ namespace libtorrent
|
|||
torrent_peer* pp = peer->peer_info_struct();
|
||||
m_picker->inc_refcount_all(pp);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(is_seed() || !m_have_all);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void torrent::peer_lost(bitfield const& bits, peer_connection const* peer)
|
||||
|
@ -4542,12 +4534,10 @@ namespace libtorrent
|
|||
torrent_peer* pp = peer->peer_info_struct();
|
||||
m_picker->dec_refcount(bits, pp);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(is_seed() || !m_have_all);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void torrent::peer_lost(int index, peer_connection const* peer)
|
||||
|
@ -4557,12 +4547,10 @@ namespace libtorrent
|
|||
torrent_peer* pp = peer->peer_info_struct();
|
||||
m_picker->dec_refcount(index, pp);
|
||||
}
|
||||
#ifdef TORRENT_DEBUG
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(is_seed() || !m_have_all);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void torrent::abort()
|
||||
|
@ -7299,7 +7287,7 @@ namespace libtorrent
|
|||
debug_log("incoming peer (%d)", int(m_connections.size()));
|
||||
#endif
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
error_code ec;
|
||||
TORRENT_ASSERT(p->remote() == p->get_socket()->remote_endpoint(ec) || ec);
|
||||
#endif
|
||||
|
@ -7603,7 +7591,7 @@ namespace libtorrent
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
for (peer_iterator i = m_connections.begin()
|
||||
, end(m_connections.end()); i != end; ++i)
|
||||
{
|
||||
|
|
|
@ -202,7 +202,7 @@ struct packet
|
|||
// sent with the DF bit set (Don't Fragment)
|
||||
bool mtu_probe:1;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
int num_fast_resend;
|
||||
#endif
|
||||
|
||||
|
@ -1018,7 +1018,7 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
TORRENT_ASSERT(len > 0);
|
||||
TORRENT_ASSERT(buf);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
int write_buffer_size = 0;
|
||||
for (std::vector<utp_socket_impl::iovec_t>::iterator i = m_impl->m_write_buffer.begin()
|
||||
, end(m_impl->m_write_buffer.end()); i != end; ++i)
|
||||
|
@ -1032,7 +1032,7 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
m_impl->m_write_buffer.push_back(utp_socket_impl::iovec_t(const_cast<void*>(buf), len));
|
||||
m_impl->m_write_buffer_size += int(len);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
write_buffer_size = 0;
|
||||
for (std::vector<utp_socket_impl::iovec_t>::iterator i = m_impl->m_write_buffer.begin()
|
||||
, end(m_impl->m_write_buffer.end()); i != end; ++i)
|
||||
|
@ -1367,7 +1367,7 @@ void utp_socket_impl::send_syn()
|
|||
p->header_size = sizeof(utp_header);
|
||||
p->num_transmissions = 0;
|
||||
p->mtu_probe = false;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
p->num_fast_resend = 0;
|
||||
#endif
|
||||
p->need_resend = false;
|
||||
|
@ -1623,7 +1623,7 @@ void utp_socket_impl::write_payload(std::uint8_t* ptr, int size)
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
int write_buffer_size = 0;
|
||||
for (std::vector<iovec_t>::iterator i = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); i != end; ++i)
|
||||
|
@ -1662,7 +1662,7 @@ void utp_socket_impl::write_payload(std::uint8_t* ptr, int size)
|
|||
m_write_buffer.erase(m_write_buffer.begin()
|
||||
, m_write_buffer.begin() + buffers_to_clear);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
write_buffer_size = 0;
|
||||
for (std::vector<iovec_t>::iterator j = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); j != end; ++j)
|
||||
|
@ -1921,7 +1921,7 @@ bool utp_socket_impl::send_pkt(int const flags)
|
|||
p->size = packet_size;
|
||||
p->header_size = packet_size - payload_size;
|
||||
p->num_transmissions = 0;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
p->num_fast_resend = 0;
|
||||
#endif
|
||||
p->need_resend = false;
|
||||
|
@ -2241,7 +2241,7 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend)
|
|||
m_sm->inc_stats_counter(counters::utp_packet_resend);
|
||||
if (fast_resend) m_sm->inc_stats_counter(counters::utp_fast_retransmit);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
if (fast_resend) ++p->num_fast_resend;
|
||||
#endif
|
||||
p->need_resend = false;
|
||||
|
@ -2629,7 +2629,7 @@ bool utp_socket_impl::consume_incoming_data(
|
|||
p->size = payload_size;
|
||||
p->header_size = 0;
|
||||
p->num_transmissions = 0;
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
p->num_fast_resend = 0;
|
||||
#endif
|
||||
p->need_resend = false;
|
||||
|
|
|
@ -858,10 +858,10 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
{
|
||||
TORRENT_ASSERT_VAL(m_chunk_pos == 0, m_chunk_pos);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
chunk_start = recv_buffer;
|
||||
chunk_start.begin += m_chunk_pos;
|
||||
TORRENT_ASSERT(chunk_start.left() == 0 || chunk_start.begin[0] == 'H');
|
||||
#if TORRENT_USE_ASSERTS
|
||||
buffer::const_interval chunk = recv_buffer;
|
||||
chunk.begin += m_chunk_pos;
|
||||
TORRENT_ASSERT(chunk.left() == 0 || chunk.begin[0] == 'H');
|
||||
#endif
|
||||
m_chunk_pos = -1;
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ project
|
|||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
: default-build
|
||||
<threading>multi
|
||||
<asserts>on
|
||||
<invariant-checks>full
|
||||
<link>shared
|
||||
<picker-debugging>on
|
||||
|
|
|
@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
@ -145,7 +145,7 @@ struct dht_server
|
|||
{
|
||||
entry msg = bdecode(buffer, buffer + bytes_transferred);
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
std::cerr << msg << std::endl;
|
||||
#endif
|
||||
++m_dht_requests;
|
||||
|
|
|
@ -1299,7 +1299,7 @@ void do_test_dht(address(&rand_addr)())
|
|||
//#error test num_global_nodes
|
||||
//#error test need_refresh
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
table.print_state(std::cerr);
|
||||
#endif
|
||||
|
||||
|
@ -2377,7 +2377,7 @@ TORRENT_TEST(routing_table_uniform)
|
|||
// i.e. no more than 5 levels
|
||||
TEST_EQUAL(tbl.num_active_buckets(), 5);
|
||||
|
||||
#if defined TORRENT_DHT_VERBOSE_LOGGING || defined TORRENT_DEBUG
|
||||
#if defined TORRENT_DHT_VERBOSE_LOGGING
|
||||
tbl.print_state(std::cerr);
|
||||
#endif
|
||||
}
|
||||
|
@ -2402,7 +2402,7 @@ TORRENT_TEST(routing_table_balance)
|
|||
std::printf("num_active_buckets: %d\n", tbl.num_active_buckets());
|
||||
TEST_EQUAL(tbl.num_active_buckets(), 2);
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
tbl.print_state(std::cerr);
|
||||
#endif
|
||||
}
|
||||
|
@ -2431,7 +2431,7 @@ TORRENT_TEST(routing_table_extended)
|
|||
}
|
||||
TEST_EQUAL(tbl.num_active_buckets(), 6);
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
tbl.print_state(std::cerr);
|
||||
#endif
|
||||
}
|
||||
|
@ -2466,7 +2466,7 @@ TORRENT_TEST(routing_table_set_id)
|
|||
std::set<node_id> original_nodes;
|
||||
tbl.for_each_node(std::bind(&inserter, &original_nodes, _1));
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
tbl.print_state(std::cerr);
|
||||
#endif
|
||||
|
||||
|
@ -2486,7 +2486,7 @@ TORRENT_TEST(routing_table_set_id)
|
|||
// all remaining nodes also exist in the original nodes
|
||||
TEST_EQUAL(intersection.size(), remaining_nodes.size());
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
tbl.print_state(std::cerr);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ TORRENT_TEST(default_settings)
|
|||
// by save_settings
|
||||
TEST_EQUAL(e.dict().size(), 0);
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
if (e.dict().size() > 0)
|
||||
std::cerr << e << std::endl;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue