Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion include/libtorrent/settings_pack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this released in the last release from 2.0.x? I was released in 2.1rc1, but that's probably fine to change. This is user facing so if it has been released we need to just add an alias

allow_multiple_connections_per_peer_id,

max_bool_setting_internal
};
Expand Down
2 changes: 1 addition & 1 deletion simulation/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct test_result
std::vector<lt::tcp::endpoint> 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)
Expand All @@ -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
Expand Down Expand Up @@ -138,28 +138,28 @@ bool has_connected(std::vector<lt::tcp::endpoint> 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
Expand Down
2 changes: 1 addition & 1 deletion src/bt_peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/settings_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading