修复异常在线数量错误

This commit is contained in:
flswld
2023-02-11 21:31:10 +08:00
parent b5b5cf59a5
commit e4be36a434
2 changed files with 2 additions and 1 deletions

View File

@@ -150,6 +150,7 @@ func (k *KcpConnectManager) acceptHandle(listener *kcp.Listener) {
}
conn.SetACKNoDelay(true)
conn.SetWriteDelay(false)
atomic.AddInt32(&CLIENT_CONN_NUM, 1)
logger.Info("client connect, convId: %v", convId)
kcpRawSendChan := make(chan *ProtoMsg, 1000)
session := &Session{

View File

@@ -377,7 +377,7 @@ func (k *KcpConnectManager) getPlayerToken(req *proto.GetPlayerTokenReq, session
// 封号通知
return loginFailRsp(int32(proto.Retcode_RET_BLACK_UID), true, tokenVerifyRsp.ForbidEndTime)
}
clientConnNum := atomic.AddInt32(&CLIENT_CONN_NUM, 1)
clientConnNum := atomic.LoadInt32(&CLIENT_CONN_NUM)
if clientConnNum > MaxClientConnNumLimit {
logger.Error("gate conn num limit, uid: %v", uid)
return loginFailRsp(int32(proto.Retcode_RET_MAX_PLAYER), false, 0)