fix non-IPv6 build

This commit is contained in:
Arvid Norberg 2011-02-09 07:27:04 +00:00
parent b39c831115
commit 813d88a50e
2 changed files with 15 additions and 6 deletions

View File

@ -119,6 +119,15 @@ namespace libtorrent
int flags;
};
int num_outstanding() const
{
return m_v4_outstanding
#if TORRENT_USE_IPV6
+ m_v6_outstanding
#endif
;
}
private:
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
// necessary for logging member offsets

View File

@ -256,7 +256,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
if (m_abort)
{
if (m_v4_outstanding + m_v6_outstanding == 0)
if (num_outstanding() == 0)
{
// "this" may be destructed in the callback
callback_t tmp = m_callback;
@ -294,7 +294,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
&& e != asio::error::operation_aborted
&& e != asio::error::message_size)
{
if (m_v4_outstanding + m_v6_outstanding == 0)
if (num_outstanding() == 0)
{
// "this" may be destructed in the callback
callback_t tmp = m_callback;
@ -309,7 +309,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
add_outstanding_async("udp_socket::on_read");
#endif
#if TORRENT_USE_IPV6
if (s == &m_ipv6_sock && m_v6_outstanding == 0)
if (s == &m_ipv6_sock && num_outstanding() == 0)
{
maybe_realloc_buffers(2);
++m_v6_outstanding;
@ -356,7 +356,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
if (m_abort) return;
if (m_v6_outstanding == 0)
if (num_outstanding() == 0)
{
maybe_realloc_buffers(2);
@ -543,7 +543,7 @@ void udp_socket::close()
m_abort = true;
#ifdef TORRENT_DEBUG
m_outstanding_when_aborted = m_v4_outstanding + m_v6_outstanding;
m_outstanding_when_aborted = num_outstanding();
#endif
if (m_connection_ticket >= 0)
@ -552,7 +552,7 @@ void udp_socket::close()
m_connection_ticket = -1;
}
if (m_v4_outstanding + m_v6_outstanding == 0)
if (num_outstanding() == 0)
{
// "this" may be destructed in the callback
callback_t tmp = m_callback;