找回密码
 立即注册
虾米引擎源代码Delphi3KM2引擎源码20121218CQFIR飞尔引擎20120918源码文字广告位置4
APPLEM2引擎源代码传奇引擎delphi源代码DELPHI视频教程
GSQL_6.5.2.1源代码Delphi即时通讯Delphi源码文字广告位置11
文字广告位置12
文字广告位置13
文字广告位置14
文字广告位置15
文字广告位置16
UC845刺客引擎飞龙3delphi源码文字广告位置18
文字广告位置19
文字广告位置20
文字广告位置21文字广告位置22
文字广告位置23
文字广告位置24
文字广告位置25
文字广告位置26文字广告位置27文字广告位置28
查看: 8|回复: 0

GXX RunGate源码限制10人数 20261116

[复制链接]

847

主题

42

回帖

6008

积分

管理员

积分
6008

最佳新人活跃会员热心会员推广达人宣传达人突出贡献优秀版主荣誉管理论坛元老

QQ
发表于 前天 12:26 | 显示全部楼层 |阅读模式
RunGateUtils.pas
2156行-2163行




procedure TRunGate.OnAcceptConnect(Sender: TIocpTcpServer;
  RemoteAddr: string; RemotePort: Word; var IsAccept: Boolean);
var
  AddressInfo: pTAddressInfo;
begin
  // 移自 TMirClientContext.DoConnect,放在这里更合理高效 chongchong 2016-07-05
  if {$IF UseIocpClient = 0} FClientSocket.Active {$ELSE} TcpClient.Active {$IFEND} then
  begin
    {
    // 测试插件限定10个人 chongchong 2018-08-14 21:08:14
    if g_IsTestPlugin2 and (TIocpClientContextPool.Instance.OnlineContextCount > 10) then
    begin
      IsAccept := False;
      Exit;
    end;
    }


--------------------------------------------------------------------------------------------------------------------------------------------------
MirClientContext.pas
9957行-9964行

ErrorNum := 0;
  try
    RunGate.OnlineUser.Lock;
    try
      RunGate.OnlineUser.Add(Self);
      OnlineUserCount := RunGate.OnlineUser.Count;
      if RunGate.nMaxOnlineUserCount < OnlineUserCount then
        RunGate.nMaxOnlineUserCount := OnlineUserCount;
    finally
      RunGate.OnlineUser.Unlock;
    end;

    {
    // 测试插件限定10个人 chongchong 2018-08-14 21:08:14
    if g_IsTestPlugin and (OnlineUserCount >= 10) then
    begin
      Close;
      Exit;
    end;
    }

    ErrorNum := 11;
    aRemote := AnsiString(RemoteAddr);
    RunGate.{$IF UseIocpClient = 1}TcpClient.{$IFEND}SendServerMsg(GM_OPEN, ContextID, Socket, 0, PAnsiChar(aRemote), Length(aRemote));
    AddMainLogMsg('开始连接: ' + RemoteAddr, 5);

    nUserListIndex := 0;

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|Delphi源代码

GMT+8, 2026-11-18 03:06 , Processed in 0.074896 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表