From 077f728931dc036604419e74f1c51fbb092d2197 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 26 Jan 2014 08:36:56 +0000 Subject: [PATCH] more test_transfer polish. fix issue where passing on our listen port depended on anonymous_mode, instead of use_proxy. not passing it on would break a few unit tests --- src/bt_peer_connection.cpp | 6 +++++- test/test_transfer.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 981c0ec67..eb1f3c09f 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -2123,12 +2123,16 @@ namespace libtorrent entry handshake; entry::dictionary_type& m = handshake["m"].dict(); + // if we're using a proxy, our listen port won't be useful + // anyway. + if (!m_ses.settings().force_proxy && is_outgoing()) + handshake["p"] = m_ses.listen_port(); + // only send the port in case we bade the connection // on incoming connections the other end already knows // our listen port if (!m_ses.m_settings.anonymous_mode) { - if (is_outgoing()) handshake["p"] = m_ses.listen_port(); handshake["v"] = m_ses.settings().handshake_client_version.empty() ? m_ses.settings().user_agent : m_ses.settings().handshake_client_version; } diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 0319f6f01..1d222b923 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -196,7 +196,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe , std::make_pair(48075 + listen_port, 49000), "0.0.0.0", 0, alert_mask); session ses2(fingerprint("LT", 0, 1, 0, 0) , std::make_pair(49075 + listen_port, 50000), "0.0.0.0", 0, alert_mask); - ++listen_port; + listen_port += 10; proxy_settings ps; if (proxy_type)