diff --git a/Makefile b/Makefile index 0fb8cee3700..feea8ef00ee 100644 --- a/Makefile +++ b/Makefile @@ -753,7 +753,7 @@ SIM_SOURCES = \ setup_dht.hpp \ setup_swarm.cpp \ setup_swarm.hpp \ - test_allow_multiple_connections_per_pid.cpp \ + test_allow_multiple_connections_per_peer_id.cpp \ test_auto_manage.cpp \ test_checking.cpp \ test_dht.cpp \ diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index da4d4bb3ce4..5035cb950c7 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -1053,7 +1053,7 @@ namespace aux { // a peer has multiple IP addresses, enabling this feature // may improve transfer efficiency, but it may also // increase network load. - allow_multiple_connections_per_pid, + allow_multiple_connections_per_peer_id, max_bool_setting_internal }; diff --git a/simulation/Jamfile b/simulation/Jamfile index 30928dc6530..76c9418d1dd 100644 --- a/simulation/Jamfile +++ b/simulation/Jamfile @@ -65,5 +65,5 @@ run test_save_resume.cpp ; run test_error_handling.cpp ; run test_timeout.cpp ; run test_peer_connection.cpp ; -run test_allow_multiple_connections_per_pid.cpp ; +run test_allow_multiple_connections_per_peer_id.cpp ; diff --git a/simulation/test_allow_multiple_connections_per_pid.cpp b/simulation/test_allow_multiple_connections_per_peer_id.cpp similarity index 91% rename from simulation/test_allow_multiple_connections_per_pid.cpp rename to simulation/test_allow_multiple_connections_per_peer_id.cpp index 759619e3874..bac0c35f299 100644 --- a/simulation/test_allow_multiple_connections_per_pid.cpp +++ b/simulation/test_allow_multiple_connections_per_peer_id.cpp @@ -53,7 +53,7 @@ struct test_result std::vector connects; }; -test_result test_allow_multiple_connections_per_pid(bool allow +test_result test_allow_multiple_connections_per_peer_id(bool allow , lt::peer_id const& pid , char const* peer1_ip , char const* peer2_ip) @@ -69,7 +69,7 @@ test_result test_allow_multiple_connections_per_pid(bool allow sp.settings = settings(); sp.settings.set_int(lt::settings_pack::alert_mask , lt::alert_category::all & ~lt::alert_category::stats); - sp.settings.set_bool(lt::settings_pack::allow_multiple_connections_per_pid, allow); + sp.settings.set_bool(lt::settings_pack::allow_multiple_connections_per_peer_id, allow); sp.disk_io_constructor = lt::disabled_disk_io_constructor; // create session @@ -138,28 +138,28 @@ bool has_connected(std::vector const& endpoints } // anonymous namespace -// allow_multiple_connections_per_pid = false: +// allow_multiple_connections_per_peer_id = false: // a second connection from a different IP but the same peer-id should be rejected -TORRENT_TEST(allow_multiple_connections_per_pid_false) +TORRENT_TEST(allow_multiple_connections_per_peer_id_false) { lt::peer_id pid; std::fill(pid.data(), pid.data() + 20, char(0xAA)); - auto result = test_allow_multiple_connections_per_pid(false, pid + auto result = test_allow_multiple_connections_per_peer_id(false, pid , "60.0.0.1", "60.0.0.2"); // verify that a duplicate_peer_id disconnect occurred TEST_CHECK(has_duplicate_peer_id_error(result.disconnects)); } -// allow_multiple_connections_per_pid = true: +// allow_multiple_connections_per_peer_id = true: // a second connection from a different IP but the same peer-id should be allowed -TORRENT_TEST(allow_multiple_connections_per_pid_true) +TORRENT_TEST(allow_multiple_connections_per_peer_id_true) { lt::peer_id pid; std::fill(pid.data(), pid.data() + 20, char(0xBB)); - auto result = test_allow_multiple_connections_per_pid(true, pid + auto result = test_allow_multiple_connections_per_peer_id(true, pid , "60.0.0.3", "60.0.0.4"); // verify no duplicate_peer_id error occurred diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index fa065b68200..c01b690d106 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -3522,7 +3522,7 @@ namespace { std::copy(recv_buffer.begin(), recv_buffer.begin() + 20, pid.data()); // now, let's see if this connection should be closed - if (!t->settings().get_bool(settings_pack::allow_multiple_connections_per_pid)) + if (!t->settings().get_bool(settings_pack::allow_multiple_connections_per_peer_id)) { peer_connection* p = t->find_peer(pid); if (p) diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index 88b385a9420..934dd7f9fd9 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -242,7 +242,7 @@ constexpr int DISK_WRITE_MODE = settings_pack::enable_os_cache; SET(socks5_udp_send_local_ep, false, nullptr), SET(proxy_send_host_in_connect, false, nullptr), SET(disk_disable_copy_on_write, false, nullptr), - SET(allow_multiple_connections_per_pid, false, nullptr), + SET(allow_multiple_connections_per_peer_id, false, nullptr), }}); CONSTEXPR_SETTINGS