merged changes from RC_1_0

This commit is contained in:
Arvid Norberg 2015-06-02 01:14:52 +00:00
parent 3409c782f8
commit 5d6cba438d
4 changed files with 25 additions and 16 deletions

View File

@ -139,6 +139,11 @@ namespace libtorrent
struct queued_packet
{
queued_packet()
: hostname(NULL)
, flags(0)
{}
udp::endpoint ep;
char* hostname;
buffer buf;

View File

@ -556,13 +556,11 @@ void udp_socket::wrap(char const* hostname, int port, char const* p, int len, er
iovec[1] = asio::const_buffer(p, len);
#if TORRENT_USE_IPV6
if (m_udp_proxy_addr.address().is_v4() && m_ipv4_sock.is_open())
if (m_udp_proxy_addr.address().is_v6() && m_ipv6_sock.is_open())
m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
else
#endif
m_ipv4_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
#if TORRENT_USE_IPV6
else
m_ipv6_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
#endif
}
// unwrap the UDP packet from the SOCKS5 header

View File

@ -27,6 +27,7 @@ VERSION = '\x05'
NOAUTH = '\x00'
USERPASS = '\x02'
CONNECT = '\x01'
UDP_ASSOCIATE = '\x03'
IPV4 = '\x01'
IPV6 = '\x04'
DOMAIN_NAME = '\x03'
@ -90,8 +91,8 @@ class SocksHandler(StreamRequestHandler):
if allow_v4 and version == '\x04':
cmd = self.read(1)
if cmd != CONNECT:
error('Only supports connect method not (%r) closing' % cmd)
if cmd != CONNECT and cmd != UDP_ASSOCIATE:
error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
return
@ -160,8 +161,8 @@ class SocksHandler(StreamRequestHandler):
if version != '\x05':
error('Wrong version number (%r) closing...' % version)
self.close_request()
elif cmd != CONNECT:
error('Only supports connect method not (%r) closing' % cmd)
elif cmd != CONNECT and cmd != UDP_ASSOCIATE:
error('Only supports connect and udp-associate method not (%r) closing' % cmd)
self.close_request()
elif zero != '\x00':
error('Mangled request. Reserved field (%r) is not null' % zero)
@ -193,6 +194,11 @@ class SocksHandler(StreamRequestHandler):
except Exception, e:
print e
return
if cmd == UDP_ASSOCIATE:
debug("no UDP support yet, closing")
return;
debug("Creating forwarder connection to %s:%d" % (out_address[0], out_address[1]))
try: