From 4142dfe5eb5acee6e4473bb673e3a84bf500daa2 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 5 Dec 2016 14:49:45 -0500 Subject: [PATCH] headers and code cleanup in udp_socket code --- include/libtorrent/aux_/session_impl.hpp | 1 + include/libtorrent/udp_socket.hpp | 8 ++++---- src/udp_socket.cpp | 16 +++------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 1e8960657..b27e390c1 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/torrent_peer.hpp" #include "libtorrent/torrent_peer_allocator.hpp" #include "libtorrent/performance_counters.hpp" // for counters +#include "libtorrent/aux_/allocating_handler.hpp" #ifdef TORRENT_USE_OPENSSL #include "libtorrent/ssl_stream.hpp" diff --git a/include/libtorrent/udp_socket.hpp b/include/libtorrent/udp_socket.hpp index a6d074544..cf2c251de 100644 --- a/include/libtorrent/udp_socket.hpp +++ b/include/libtorrent/udp_socket.hpp @@ -36,12 +36,12 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket.hpp" #include "libtorrent/io_service.hpp" #include "libtorrent/error_code.hpp" -#include "libtorrent/session_settings.hpp" -#include "libtorrent/buffer.hpp" -#include "libtorrent/deadline_timer.hpp" +#include "libtorrent/aux_/proxy_settings.hpp" #include "libtorrent/debug.hpp" #include "libtorrent/span.hpp" -#include "libtorrent/aux_/allocating_handler.hpp" + +#include +#include namespace libtorrent { diff --git a/src/udp_socket.cpp b/src/udp_socket.cpp index d1631fd4b..27ebdd62e 100644 --- a/src/udp_socket.cpp +++ b/src/udp_socket.cpp @@ -31,31 +31,23 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/config.hpp" -#include "libtorrent/socket.hpp" #include "libtorrent/udp_socket.hpp" #include "libtorrent/socket_io.hpp" -#include "libtorrent/error.hpp" #include "libtorrent/settings_pack.hpp" #include "libtorrent/error.hpp" -#include "libtorrent/aux_/time.hpp" // for aux::time_now() +#include "libtorrent/time.hpp" #include "libtorrent/debug.hpp" +#include "libtorrent/deadline_timer.hpp" #include #include -#include #include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include -#include #include - #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { -using namespace libtorrent::aux; using namespace std::placeholders; // this class hold the state of the SOCKS5 connection to maintain the UDP @@ -461,7 +453,6 @@ void udp_socket::set_proxy_settings(aux::proxy_settings const& ps) { TORRENT_ASSERT(is_single_thread()); - error_code ec; if (m_socks5_connection) { m_socks5_connection->close(); @@ -477,7 +468,7 @@ void udp_socket::set_proxy_settings(aux::proxy_settings const& ps) { // connect to socks5 server and open up the UDP tunnel - m_socks5_connection = std::make_shared(std::ref(m_socket.get_io_service())); + m_socks5_connection = std::make_shared(m_socket.get_io_service()); m_socks5_connection->start(ps); } } @@ -675,7 +666,6 @@ void socks5::socks_forward_udp() write_uint8(5, p); // SOCKS VERSION 5 write_uint8(3, p); // UDP ASSOCIATE command write_uint8(0, p); // reserved - error_code ec; write_uint8(1, p); // ATYP = IPv4 write_uint32(0, p); // 0.0.0.0 write_uint16(0, p); // :0