fix: Max connection limit not applied

This commit is contained in:
yuanyuanxiang
2024-12-31 03:11:26 +08:00
parent 943c269700
commit 9561a5d09d
5 changed files with 19 additions and 1 deletions

View File

@@ -761,6 +761,10 @@ PCONTEXT_OBJECT IOCPServer::AllocateContext()
CLock cs(m_cs);
if (m_ContextConnectionList.GetCount() >= m_ulMaxConnections) {
return NULL;
}
ContextObject = !m_ContextFreePoolList.IsEmpty() ? m_ContextFreePoolList.RemoveHead() : new CONTEXT_OBJECT;
if (ContextObject != NULL)
@@ -807,3 +811,8 @@ VOID IOCPServer::MoveContextToFreePoolList(CONTEXT_OBJECT* ContextObject)
m_ContextConnectionList.RemoveAt(Pos); //<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><E1B9B9><EFBFBD>Ƴ<EFBFBD>
}
}
void IOCPServer::UpdateMaxConnection(int maxConn) {
CLock cs(m_cs);
m_ulMaxConnections = maxConn;
}