fix test_lsd to pass reliably

This commit is contained in:
arvidn 2020-01-18 01:34:01 +01:00 committed by Arvid Norberg
parent e4e967335c
commit d13109426a
3 changed files with 12 additions and 7 deletions

View File

@ -273,9 +273,10 @@ namespace aux {
// determines if connections from the same IP address as existing
// connections should be rejected or not. Rejecting multiple connections
// from the same IP address will prevent abusive
// behavior by peers. It may be useful to allow such connections in
// cases where simulations are run on the same machine, and all peers
// in a swarm has the same IP address.
// behavior by peers. The logic for determining whether connections are
// to the same peer is more complicated with this enabled, and more
// likely to fail in some edge cases. It is not recommended to enable
// this feature.
allow_multiple_connections_per_ip = bool_type_base,
#if TORRENT_ABI_VERSION == 1

View File

@ -3345,13 +3345,13 @@ bool is_downloading_state(int const st)
bool need_update = false;
for (auto const& i : resp.peers4)
{
tcp::endpoint a(address_v4(i.ip), i.port);
tcp::endpoint const a(address_v4(i.ip), i.port);
need_update |= bool(add_peer(a, peer_info::tracker) != nullptr);
}
for (auto const& i : resp.peers6)
{
tcp::endpoint a(address_v6(i.ip), i.port);
tcp::endpoint const a(address_v6(i.ip), i.port);
need_update |= bool(add_peer(a, peer_info::tracker) != nullptr);
}

View File

@ -53,8 +53,12 @@ void test_lsd()
session_proxy p2;
settings_pack pack;
pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
pack.set_int(settings_pack::alert_mask, alert::error_notification | alert::session_log_notification | alert::status_notification);
pack.set_int(settings_pack::alert_mask, alert::error_notification
| alert::session_log_notification
| alert::torrent_log_notification
| alert::peer_log_notification
| alert::ip_block_notification
| alert::status_notification);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_bool(settings_pack::enable_lsd, true);
pack.set_bool(settings_pack::enable_upnp, false);