fix: Max connection limit not applied
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user