From 010d5631a48bca3bba2be38782fc1774c8dc7a65 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 29 Dec 2007 23:47:51 +0000 Subject: [PATCH] made udp_socket not use exception --- src/udp_socket.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/udp_socket.cpp b/src/udp_socket.cpp index 3a8b75ea6..f398455d9 100644 --- a/src/udp_socket.cpp +++ b/src/udp_socket.cpp @@ -143,9 +143,10 @@ void udp_socket::unwrap(char const* buf, int size) void udp_socket::close() { - m_ipv4_sock.close(); - m_ipv6_sock.close(); - m_socks5_sock.close(); + asio::error_code ec; + m_ipv4_sock.close(ec); + m_ipv6_sock.close(ec); + m_socks5_sock.close(ec); m_callback.clear(); if (m_connection_ticket >= 0) { @@ -158,8 +159,8 @@ void udp_socket::bind(int port) { asio::error_code ec; - if (m_ipv4_sock.is_open()) m_ipv4_sock.close(); - if (m_ipv6_sock.is_open()) m_ipv6_sock.close(); + if (m_ipv4_sock.is_open()) m_ipv4_sock.close(ec); + if (m_ipv6_sock.is_open()) m_ipv6_sock.close(ec); m_ipv4_sock.open(udp::v4(), ec); if (!ec) @@ -181,7 +182,8 @@ void udp_socket::bind(int port) void udp_socket::set_proxy_settings(proxy_settings const& ps) { - m_socks5_sock.close(); + asio::error_code ec; + m_socks5_sock.close(ec); m_tunnel_packets = false; m_proxy_settings = ps; @@ -208,7 +210,8 @@ void udp_socket::on_name_lookup(asio::error_code const& e, tcp::resolver::iterat void udp_socket::on_timeout() { - m_socks5_sock.close(); + asio::error_code ec; + m_socks5_sock.close(ec); m_connection_ticket = -1; } @@ -276,7 +279,8 @@ void udp_socket::handshake2(asio::error_code const& e) { if (m_proxy_settings.username.empty()) { - m_socks5_sock.close(); + asio::error_code ec; + m_socks5_sock.close(ec); return; } @@ -292,7 +296,8 @@ void udp_socket::handshake2(asio::error_code const& e) } else { - m_socks5_sock.close(); + asio::error_code ec; + m_socks5_sock.close(ec); return; } }