1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-16 18:01:40 +00:00

Do not allocate packet quota to half-open connections

This commit is contained in:
sfan5 2024-01-05 13:54:50 +01:00
parent 3987318f09
commit 050152eb90
4 changed files with 39 additions and 20 deletions

View file

@ -1397,6 +1397,21 @@ session_t Connection::lookupPeer(const Address& sender)
return PEER_ID_INEXISTENT;
}
u32 Connection::getActiveCount()
{
MutexAutoLock peerlock(m_peers_mutex);
u32 count = 0;
for (auto &it : m_peers) {
Peer *peer = it.second;
if (peer->isPendingDeletion())
continue;
if (peer->isHalfOpen())
continue;
count++;
}
return count;
}
bool Connection::deletePeer(session_t peer_id, bool timeout)
{
Peer *peer = 0;