more size logging and potential fix for udp_tracker_connection leak

This commit is contained in:
Arvid Norberg 2010-11-16 06:41:35 +00:00
parent 8dbdd4ced4
commit 71d51b90e8
4 changed files with 58 additions and 5 deletions

View File

@ -99,6 +99,10 @@ namespace libtorrent
};
private:
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
// necessary for logging member offsets
public:
#endif
// callback for regular incoming packets
callback_t m_callback;

View File

@ -78,7 +78,10 @@ namespace libtorrent
void start();
void close();
#if !defined TORRENT_VERBOSE_LOGGING && !defined TORRENT_LOGGING && !defined TORRENT_ERROR_LOGGING
// necessary for logging member offsets
private:
#endif
enum action_t
{

View File

@ -98,6 +98,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/kademlia/observer.hpp>
#endif // TORRENT_DISABLE_DHT
#include "libtorrent/http_tracker_connection.hpp"
#include "libtorrent/udp_tracker_connection.hpp"
#include "libtorrent/debug.hpp"
#if TORRENT_USE_IOSTREAM
@ -673,6 +676,51 @@ namespace aux {
PRINT_SIZEOF(policy::ipv6_peer)
#endif
PRINT_SIZEOF(udp_socket)
PRINT_OFFSETOF(udp_socket, m_callback)
PRINT_OFFSETOF(udp_socket, m_mutex)
PRINT_OFFSETOF(udp_socket, m_ipv4_sock)
PRINT_OFFSETOF(udp_socket, m_v4_ep)
PRINT_OFFSETOF(udp_socket, m_v4_buf)
#if TORRENT_USE_IPV6
PRINT_OFFSETOF(udp_socket, m_ipv6_sock)
PRINT_OFFSETOF(udp_socket, m_v6_ep)
PRINT_OFFSETOF(udp_socket, m_v6_buf)
#endif
PRINT_OFFSETOF(udp_socket, m_bind_port)
PRINT_OFFSETOF(udp_socket, m_outstanding)
PRINT_OFFSETOF(udp_socket, m_socks5_sock)
PRINT_OFFSETOF(udp_socket, m_connection_ticket)
PRINT_OFFSETOF(udp_socket, m_proxy_settings)
PRINT_OFFSETOF(udp_socket, m_cc)
PRINT_OFFSETOF(udp_socket, m_resolver)
PRINT_OFFSETOF(udp_socket, m_tmp_buf)
PRINT_OFFSETOF(udp_socket, m_queue_packets)
PRINT_OFFSETOF(udp_socket, m_tunnel_packets)
PRINT_OFFSETOF(udp_socket, m_abort)
PRINT_OFFSETOF(udp_socket, m_proxy_addr)
PRINT_OFFSETOF(udp_socket, m_queue)
#ifdef TORRENT_DEBUG
PRINT_OFFSETOF(udp_socket, m_started)
PRINT_OFFSETOF(udp_socket, m_magic)
PRINT_OFFSETOF(udp_socket, m_outstanding_when_aborted)
#endif
PRINT_SIZEOF(tracker_connection)
PRINT_SIZEOF(http_tracker_connection)
PRINT_SIZEOF(udp_tracker_connection)
PRINT_OFFSETOF(udp_tracker_connection, m_man)
PRINT_OFFSETOF(udp_tracker_connection, m_abort)
PRINT_OFFSETOF(udp_tracker_connection, m_hostname)
PRINT_OFFSETOF(udp_tracker_connection, m_target)
PRINT_OFFSETOF(udp_tracker_connection, m_endpoints)
PRINT_OFFSETOF(udp_tracker_connection, m_transaction_id)
PRINT_OFFSETOF(udp_tracker_connection, m_ses)
PRINT_OFFSETOF(udp_tracker_connection, m_attempts)
PRINT_OFFSETOF(udp_tracker_connection, m_state)
PRINT_OFFSETOF(udp_tracker_connection, m_proxy)
#ifndef TORRENT_DISABLE_DHT
PRINT_SIZEOF(dht::find_data_observer)
PRINT_SIZEOF(dht::announce_observer)

View File

@ -296,8 +296,6 @@ namespace libtorrent
// ignore packets smaller than 8 bytes
if (size < 8) return false;
restart_read_timeout();
const char* ptr = buf;
int action = detail::read_int32(ptr);
int transaction = detail::read_int32(ptr);
@ -323,6 +321,8 @@ namespace libtorrent
// ignore packets that's not a response to our message
if (action != m_state) return false;
restart_read_timeout();
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
if (cb)
{
@ -490,7 +490,7 @@ namespace libtorrent
if (!cb)
{
m_man.remove_request(this);
close();
return true;
}
@ -523,7 +523,6 @@ namespace libtorrent
cb->tracker_response(tracker_req(), m_target.address(), ip_list
, peer_list, interval, min_interval, complete, incomplete, address());
m_man.remove_request(this);
close();
return true;
}
@ -572,7 +571,6 @@ namespace libtorrent
cb->tracker_scrape_response(tracker_req()
, complete, incomplete, downloaded, -1);
m_man.remove_request(this);
close();
return true;
}