clear the queued packets on socks5 error, as a precaution

This commit is contained in:
Arvid Norberg
2011-09-17 23:03:46 +00:00
parent 2a6b019431
commit d27430a8c3

View File

@@ -1091,12 +1091,17 @@ void udp_socket::connect2(error_code const& e)
--m_outstanding_ops; --m_outstanding_ops;
if (m_abort) if (m_abort)
{ {
m_queue.clear();
maybe_clear_callback(); maybe_clear_callback();
return; return;
} }
CHECK_MAGIC; CHECK_MAGIC;
if (e) return; if (e)
{
m_queue.clear();
return;
}
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
@@ -1108,8 +1113,11 @@ void udp_socket::connect2(error_code const& e)
++p; // RESERVED ++p; // RESERVED
int atyp = read_uint8(p); // address type int atyp = read_uint8(p); // address type
if (version != 5) return; if (version != 5 || status != 0)
if (status != 0) return; {
m_queue.clear();
return;
}
if (atyp == 1) if (atyp == 1)
{ {
@@ -1120,6 +1128,8 @@ void udp_socket::connect2(error_code const& e)
{ {
// in this case we need to read more data from the socket // in this case we need to read more data from the socket
TORRENT_ASSERT(false && "not implemented yet!"); TORRENT_ASSERT(false && "not implemented yet!");
m_queue.clear();
return;
} }
m_tunnel_packets = true; m_tunnel_packets = true;