[Libtorrent-commits] SF.net SVN: libtorrent:[11140] branches/RC_1_0
Brought to you by:
arvidn
From: <ar...@us...> - 2015-06-01 02:38:44
|
Revision: 11140 http://sourceforge.net/p/libtorrent/code/11140 Author: arvidn Date: 2015-06-01 02:38:41 +0000 (Mon, 01 Jun 2015) Log Message: ----------- attempt to make the socks5 proxy disconnect at a different time when issuing a udp associate command. the hope was to reproduce a bug, but it didn't Modified Paths: -------------- branches/RC_1_0/src/udp_socket.cpp branches/RC_1_0/test/socks.py branches/RC_1_0/test/test_transfer.cpp Modified: branches/RC_1_0/src/udp_socket.cpp =================================================================== --- branches/RC_1_0/src/udp_socket.cpp 2015-05-31 21:57:38 UTC (rev 11139) +++ branches/RC_1_0/src/udp_socket.cpp 2015-06-01 02:38:41 UTC (rev 11140) @@ -148,7 +148,7 @@ { // send udp packets through SOCKS5 server wrap(hostname, port, p, len, ec); - return; + return; } // this function is only supported when we're using a proxy @@ -192,7 +192,7 @@ { // send udp packets through SOCKS5 server wrap(ep, p, len, ec); - return; + return; } if (m_queue_packets) @@ -793,7 +793,7 @@ error_code ec; m_socks5_sock.close(ec); m_tunnel_packets = false; - + m_proxy_settings = ps; if (m_abort) return; @@ -863,7 +863,7 @@ m_proxy_addr.address(i->endpoint().address()); m_proxy_addr.port(i->endpoint().port()); // on_connect may be called from within this thread - // the semantics for on_connect and on_timeout is + // the semantics for on_connect and on_timeout is // a bit complicated. See comments in connection_queue.hpp // for more details. This semantic determines how and // when m_outstanding_ops may be decremented @@ -1387,7 +1387,7 @@ drain_queue(); return; } - + m_tunnel_packets = true; drain_queue(); Modified: branches/RC_1_0/test/socks.py =================================================================== --- branches/RC_1_0/test/socks.py 2015-05-31 21:57:38 UTC (rev 11139) +++ branches/RC_1_0/test/socks.py 2015-06-01 02:38:41 UTC (rev 11140) @@ -10,10 +10,10 @@ import sys def debug(s): - print >>sys.stderr, 'socks.py: ', s + print >>sys.stderr, 'socks.py: ', s def error(s): - print >>sys.stderr, 'socks.py, ERROR: ', s + print >>sys.stderr, 'socks.py, ERROR: ', s class MyTCPServer(ThreadingTCPServer): allow_reuse_address = True @@ -27,6 +27,7 @@ NOAUTH = '\x00' USERPASS = '\x02' CONNECT = '\x01' +UDP_ASSOCIATE = '\x03' IPV4 = '\x01' IPV6 = '\x04' DOMAIN_NAME = '\x03' @@ -90,8 +91,8 @@ 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 @@ 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 @@ 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: Modified: branches/RC_1_0/test/test_transfer.cpp =================================================================== --- branches/RC_1_0/test/test_transfer.cpp 2015-05-31 21:57:38 UTC (rev 11139) +++ branches/RC_1_0/test/test_transfer.cpp 2015-06-01 02:38:41 UTC (rev 11140) @@ -181,7 +181,7 @@ fprintf(stderr, "\n\n ==== TESTING %s proxy ==== disk-full: %s allow-fast: %s\n\n\n" , test_name[proxy_type], test_disk_full ? "true": "false", test_allowed_fast ? "true" : "false"); - + // in case the previous run was terminated error_code ec; remove_all("tmp1_transfer", ec); @@ -352,7 +352,7 @@ if (st2.state != torrent_status::downloading) { - static char const* state_str[] = + static char const* state_str[] = {"checking (q)", "checking", "dl metadata" , "downloading", "finished", "seeding", "allocating", "checking (r)"}; std::cerr << "st2 state: " << state_str[st2.state] << std::endl; @@ -388,10 +388,10 @@ // test with all kinds of proxies for (int i = 0; i < 6; ++i) test_transfer(i); - + // test with a (simulated) full disk test_transfer(0, true, true); - + // test allowed fast test_transfer(0, false, true); @@ -403,7 +403,7 @@ fprintf(stderr, "compact mode\n"); test_transfer(0, false, false, storage_mode_compact); #endif - + error_code ec; remove_all("tmp1_transfer", ec); remove_all("tmp2_transfer", ec); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |