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:
parent
3987318f09
commit
050152eb90
4 changed files with 39 additions and 20 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue