1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 16:24:02 +00:00

fix: assertion failed: port_empty in tr_swarm::remove_peer() (#6062)

This commit is contained in:
Yat Ho 2023-10-03 00:57:48 +08:00 committed by GitHub
parent 170f589b64
commit 5808f72f50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -273,8 +273,7 @@ public:
auto* const peer_info = peer->peer_info;
auto const socket_address = peer->socket_address();
auto const listen_socket_address = peer_info->listen_socket_address();
auto const was_incoming = peer->is_incoming_connection();
[[maybe_unused]] auto const is_incoming = peer->is_incoming_connection();
TR_ASSERT(peer_info != nullptr);
--stats.peer_count;
@ -288,15 +287,16 @@ public:
delete peer;
if (was_incoming)
if (std::empty(peer_info->listen_port())) // is not connectable
{
[[maybe_unused]] auto const port_empty = std::empty(peer_info->listen_port());
if (incoming_pool.erase(socket_address) != 0U)
{
TR_ASSERT(port_empty);
}
TR_ASSERT(is_incoming);
[[maybe_unused]] auto const count = incoming_pool.erase(socket_address);
TR_ASSERT(count != 0U);
}
else
{
graveyard_pool.erase(peer_info->listen_socket_address());
}
graveyard_pool.erase(listen_socket_address);
}
void remove_all_peers()