merged changes from RC_1_0
This commit is contained in:
parent
3409c782f8
commit
5d6cba438d
|
@ -139,6 +139,11 @@ namespace libtorrent
|
||||||
|
|
||||||
struct queued_packet
|
struct queued_packet
|
||||||
{
|
{
|
||||||
|
queued_packet()
|
||||||
|
: hostname(NULL)
|
||||||
|
, flags(0)
|
||||||
|
{}
|
||||||
|
|
||||||
udp::endpoint ep;
|
udp::endpoint ep;
|
||||||
char* hostname;
|
char* hostname;
|
||||||
buffer buf;
|
buffer buf;
|
||||||
|
|
|
@ -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);
|
iovec[1] = asio::const_buffer(p, len);
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#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
|
#endif
|
||||||
m_ipv4_sock.send_to(iovec, m_udp_proxy_addr, 0, ec);
|
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
|
// unwrap the UDP packet from the SOCKS5 header
|
||||||
|
|
|
@ -27,6 +27,7 @@ VERSION = '\x05'
|
||||||
NOAUTH = '\x00'
|
NOAUTH = '\x00'
|
||||||
USERPASS = '\x02'
|
USERPASS = '\x02'
|
||||||
CONNECT = '\x01'
|
CONNECT = '\x01'
|
||||||
|
UDP_ASSOCIATE = '\x03'
|
||||||
IPV4 = '\x01'
|
IPV4 = '\x01'
|
||||||
IPV6 = '\x04'
|
IPV6 = '\x04'
|
||||||
DOMAIN_NAME = '\x03'
|
DOMAIN_NAME = '\x03'
|
||||||
|
@ -90,8 +91,8 @@ class SocksHandler(StreamRequestHandler):
|
||||||
|
|
||||||
if allow_v4 and version == '\x04':
|
if allow_v4 and version == '\x04':
|
||||||
cmd = self.read(1)
|
cmd = self.read(1)
|
||||||
if cmd != CONNECT:
|
if cmd != CONNECT and cmd != UDP_ASSOCIATE:
|
||||||
error('Only supports connect method not (%r) closing' % cmd)
|
error('Only supports connect and udp-associate method not (%r) closing' % cmd)
|
||||||
self.close_request()
|
self.close_request()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -160,8 +161,8 @@ class SocksHandler(StreamRequestHandler):
|
||||||
if version != '\x05':
|
if version != '\x05':
|
||||||
error('Wrong version number (%r) closing...' % version)
|
error('Wrong version number (%r) closing...' % version)
|
||||||
self.close_request()
|
self.close_request()
|
||||||
elif cmd != CONNECT:
|
elif cmd != CONNECT and cmd != UDP_ASSOCIATE:
|
||||||
error('Only supports connect method not (%r) closing' % cmd)
|
error('Only supports connect and udp-associate method not (%r) closing' % cmd)
|
||||||
self.close_request()
|
self.close_request()
|
||||||
elif zero != '\x00':
|
elif zero != '\x00':
|
||||||
error('Mangled request. Reserved field (%r) is not null' % zero)
|
error('Mangled request. Reserved field (%r) is not null' % zero)
|
||||||
|
@ -193,6 +194,11 @@ class SocksHandler(StreamRequestHandler):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
return
|
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]))
|
debug("Creating forwarder connection to %s:%d" % (out_address[0], out_address[1]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue