diff --git a/include/libtorrent/udp_socket.hpp b/include/libtorrent/udp_socket.hpp index dd475a25e..277996d6c 100644 --- a/include/libtorrent/udp_socket.hpp +++ b/include/libtorrent/udp_socket.hpp @@ -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; diff --git a/include/libtorrent/udp_tracker_connection.hpp b/include/libtorrent/udp_tracker_connection.hpp index a29bfa474..b2331cfcd 100644 --- a/include/libtorrent/udp_tracker_connection.hpp +++ b/include/libtorrent/udp_tracker_connection.hpp @@ -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 { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index a46430be6..3c4bba94f 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -98,6 +98,9 @@ POSSIBILITY OF SUCH DAMAGE. #include #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) diff --git a/src/udp_tracker_connection.cpp b/src/udp_tracker_connection.cpp index 721bb258a..8bc9f535a 100644 --- a/src/udp_tracker_connection.cpp +++ b/src/udp_tracker_connection.cpp @@ -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; }