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
1 changed files with 13 additions and 3 deletions

View File

@ -1091,12 +1091,17 @@ void udp_socket::connect2(error_code const& e)
--m_outstanding_ops;
if (m_abort)
{
m_queue.clear();
maybe_clear_callback();
return;
}
CHECK_MAGIC;
if (e) return;
if (e)
{
m_queue.clear();
return;
}
TORRENT_ASSERT(is_single_thread());
@ -1108,8 +1113,11 @@ void udp_socket::connect2(error_code const& e)
++p; // RESERVED
int atyp = read_uint8(p); // address type
if (version != 5) return;
if (status != 0) return;
if (version != 5 || status != 0)
{
m_queue.clear();
return;
}
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
TORRENT_ASSERT(false && "not implemented yet!");
m_queue.clear();
return;
}
m_tunnel_packets = true;