more build fixes and cleaning up
This commit is contained in:
parent
702b68ecc4
commit
8ab1d8b686
|
@ -5,6 +5,7 @@
|
|||
#ifndef TORRENT_INVARIANT_ACCESS_HPP_INCLUDED
|
||||
#define TORRENT_INVARIANT_ACCESS_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
@ -66,12 +67,14 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_ASSERTS && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#define TORRENT_USE_INVARIANT_CHECKS 1
|
||||
#define INVARIANT_CHECK \
|
||||
invariant_checker const& _invariant_check = make_invariant_checker(*this); \
|
||||
(void)_invariant_check; \
|
||||
do {} while (false)
|
||||
#else
|
||||
#define TORRENT_USE_INVARIANT_CHECKS 0
|
||||
#define INVARIANT_CHECK do {} while (false)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ namespace libtorrent
|
|||
|
||||
void assign_bandwidth(int channel, int amount);
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
void check_invariant() const;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1279,7 +1279,7 @@ namespace libtorrent
|
|||
piece_picker& p = t->picker();
|
||||
p.abort_download(b.block, peer_info_struct());
|
||||
}
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
}
|
||||
|
@ -2123,14 +2123,14 @@ namespace libtorrent
|
|||
// progress of this torrent increased
|
||||
t->state_updated();
|
||||
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
}
|
||||
|
||||
void peer_connection::start_receive_piece(peer_request const& r)
|
||||
{
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
#if TORRENT_USE_ASSERTS
|
||||
|
@ -2308,7 +2308,7 @@ namespace libtorrent
|
|||
|
||||
#ifdef TORRENT_DEBUG
|
||||
check_postcondition post_checker_(t);
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
t->check_invariant();
|
||||
#endif
|
||||
#endif
|
||||
|
@ -2424,7 +2424,7 @@ namespace libtorrent
|
|||
--i;
|
||||
--block_index;
|
||||
TORRENT_ASSERT(m_download_queue[block_index] == pending_b);
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
}
|
||||
|
@ -2524,7 +2524,7 @@ namespace libtorrent
|
|||
|
||||
TORRENT_ASSERT(picker.num_peers(block_finished) == 0);
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS \
|
||||
#if TORRENT_USE_INVARIANT_CHECKS \
|
||||
&& defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
t->check_invariant();
|
||||
#endif
|
||||
|
@ -3302,7 +3302,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(verify_piece(t->to_req(block.block)));
|
||||
m_download_queue.push_back(block);
|
||||
m_outstanding_bytes += block_size;
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
|
||||
|
@ -3347,7 +3347,7 @@ namespace libtorrent
|
|||
|
||||
r.length += block_size;
|
||||
m_outstanding_bytes += block_size;
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
}
|
||||
|
@ -3662,7 +3662,7 @@ namespace libtorrent
|
|||
}
|
||||
m_queued_time_critical = 0;
|
||||
|
||||
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
t->remove_peer(this);
|
||||
|
@ -4652,7 +4652,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_channel_state[channel] & peer_info::bw_limit);
|
||||
m_channel_state[channel] &= ~peer_info::bw_limit;
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
check_invariant();
|
||||
#endif
|
||||
|
||||
|
@ -5731,7 +5731,7 @@ namespace libtorrent
|
|||
setup_send();
|
||||
}
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#if TORRENT_USE_INVARIANT_CHECKS
|
||||
struct peer_count_t
|
||||
{
|
||||
peer_count_t(): num_peers(0), num_peers_with_timeouts(0), num_peers_with_nowant(0), num_not_requested(0) {}
|
||||
|
|
|
@ -619,7 +619,7 @@ void udp_socket::close()
|
|||
m_resolver.cancel();
|
||||
m_abort = true;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
m_outstanding_when_aborted = num_outstanding();
|
||||
#endif
|
||||
|
||||
|
@ -737,7 +737,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
|
|||
setup_read(&m_ipv6_sock);
|
||||
}
|
||||
#endif
|
||||
#ifdef TORRENT_DEBUG
|
||||
#if TORRENT_USE_ASSERTS
|
||||
m_started = true;
|
||||
#endif
|
||||
m_bind_port = ep.port();
|
||||
|
|
|
@ -254,7 +254,7 @@ int test_main()
|
|||
policy::ipv4_peer tmp2(endp, false, 0);
|
||||
policy::ipv4_peer tmp3(endp, false, 0);
|
||||
policy::ipv4_peer peer_struct(endp, true, 0);
|
||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
#if TORRENT_USE_ASSERTS
|
||||
tmp1.in_use = true;
|
||||
tmp2.in_use = true;
|
||||
tmp3.in_use = true;
|
||||
|
|
Loading…
Reference in New Issue