more fixing of test_transfer proxy tests

This commit is contained in:
arvidn 2016-02-24 00:03:56 -05:00
parent 7fdc2e6308
commit dcd6af6473
3 changed files with 9 additions and 14 deletions

View File

@ -560,12 +560,12 @@ namespace libtorrent
// If true, disables any communication that's not going over a proxy. // If true, disables any communication that's not going over a proxy.
// Enabling this requires a proxy to be configured as well, see // Enabling this requires a proxy to be configured as well, see
// ``set_proxy_settings``. The listen sockets are closed, and incoming // proxy_type and proxy_hostname settings. The listen sockets are
// connections will only be accepted through a SOCKS5 or I2P proxy (if // closed, and incoming connections will only be accepted through a
// a peer proxy is set up and is run on the same machine as the // SOCKS5 or I2P proxy (if a peer proxy is set up and is run on the
// tracker proxy). This setting also disabled peer country lookups, // same machine as the tracker proxy). This setting also disabled peer
// since those are done via DNS lookups that aren't supported by // country lookups, since those are done via DNS lookups that aren't
// proxies. // supported by proxies.
force_proxy, force_proxy,
// if false, prevents libtorrent to advertise share-mode support // if false, prevents libtorrent to advertise share-mode support

View File

@ -2221,7 +2221,7 @@ retry:
void session_impl::open_new_incoming_socks_connection() void session_impl::open_new_incoming_socks_connection()
{ {
int proxy_type = m_settings.get_int(settings_pack::proxy_type); int const proxy_type = m_settings.get_int(settings_pack::proxy_type);
if (proxy_type != settings_pack::socks5 if (proxy_type != settings_pack::socks5
&& proxy_type != settings_pack::socks5_pw && proxy_type != settings_pack::socks5_pw
@ -2231,7 +2231,7 @@ retry:
if (m_socks_listen_socket) return; if (m_socks_listen_socket) return;
m_socks_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service)); m_socks_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
bool ret = instantiate_connection(m_io_service, proxy() bool const ret = instantiate_connection(m_io_service, proxy()
, *m_socks_listen_socket, NULL, NULL, false, false); , *m_socks_listen_socket, NULL, NULL, false, false);
TORRENT_ASSERT_VAL(ret, ret); TORRENT_ASSERT_VAL(ret, ret);
TORRENT_UNUSED(ret); TORRENT_UNUSED(ret);

View File

@ -169,6 +169,7 @@ void test_transfer(int proxy_type, settings_pack const& sett
pack.set_str(settings_pack::proxy_password, "testpass"); pack.set_str(settings_pack::proxy_password, "testpass");
pack.set_int(settings_pack::proxy_type, proxy_type); pack.set_int(settings_pack::proxy_type, proxy_type);
pack.set_int(settings_pack::proxy_port, proxy_port); pack.set_int(settings_pack::proxy_port, proxy_port);
pack.set_bool(settings_pack::force_proxy, true);
// test resetting the proxy in quick succession. // test resetting the proxy in quick succession.
// specifically the udp_socket connecting to a new // specifically the udp_socket connecting to a new
@ -176,14 +177,8 @@ void test_transfer(int proxy_type, settings_pack const& sett
// in progress. // in progress.
pack.set_str(settings_pack::proxy_hostname, "5.6.7.8"); pack.set_str(settings_pack::proxy_hostname, "5.6.7.8");
ses1.apply_settings(pack); ses1.apply_settings(pack);
pack.set_str(settings_pack::proxy_hostname, "127.0.0.1"); pack.set_str(settings_pack::proxy_hostname, "127.0.0.1");
ses1.apply_settings(pack); ses1.apply_settings(pack);
ses2.apply_settings(pack);
// ses1 is connecting to ses2, so only ses1 should be using the proxy
pack.set_int(settings_pack::proxy_type, settings_pack::none);
ses1.apply_settings(pack);
} }
pack = sett; pack = sett;