fix: Limit the online host number which uses UDP

This commit is contained in:
yuanyuanxiang
2025-07-20 01:18:16 +08:00
parent 1b1ce090c8
commit 07f6c92306
2 changed files with 15 additions and 0 deletions

View File

@@ -51,6 +51,11 @@ void IOCPUDPServer::PostRecv() {
if (!m_running) return;
IO_CONTEXT* ioCtx = AddCount();
if (ioCtx == nullptr) {
Mprintf("IOCPUDPServer max connection number reached.\n");
return;
}
CONTEXT_UDP* ctx = ioCtx->pContext;
ctx->wsaInBuf.buf = ctx->szBuffer;
ctx->wsaInBuf.len = sizeof(ctx->szBuffer);