You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.7 KiB
76 lines
1.7 KiB
/*
|
|
Sog 游戏基础库
|
|
2016 by zouwei
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using Sog.Crypto;
|
|
|
|
namespace Gate
|
|
{
|
|
public enum GameClientState
|
|
{
|
|
//客户端连接后通知后端服务器,等待后端服务器回应中
|
|
WaitServerAck = 0,
|
|
|
|
//正常回应后的客户端
|
|
Noraml = 1,
|
|
|
|
//关闭状态
|
|
Closed = 2,
|
|
}
|
|
|
|
public class FlowCheckInfo
|
|
{
|
|
public long nextResetTime; //下次重置时间
|
|
public int messageNum; //消息数量
|
|
public int messageLenth; //消息长度
|
|
public int aboveLimitTimes; //达到限制值的次数
|
|
public Dictionary<int,int> messageNumMap = new Dictionary<int, int>(); //指定id消息的数量
|
|
|
|
public void CleanData()
|
|
{
|
|
messageNum = 0;
|
|
messageLenth = 0;
|
|
messageNumMap.Clear();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public class GateClientInfo
|
|
{
|
|
public GameClientState State;
|
|
|
|
public long SessionID;
|
|
|
|
//连接的serverID(比如 game有多个,这里连的是哪个,但是Account和Version只有一个用处不大)
|
|
public uint LinkServerID;
|
|
|
|
// close when gameserver timeout
|
|
public long ConnectedTime;
|
|
|
|
public NetSession Session;
|
|
|
|
public SogFastXTEAKey TeaKey;//加密密钥
|
|
|
|
public ushort RecvSeq;
|
|
public ushort SendSeq;
|
|
|
|
public FlowCheckInfo FlowCheckInfo; //流量检测信息
|
|
|
|
public GateClientInfo(long time, NetSession session)
|
|
{
|
|
Session = session;
|
|
SessionID = session.SessionID;
|
|
ConnectedTime = time;
|
|
|
|
State = GameClientState.WaitServerAck;
|
|
}
|
|
}
|
|
}
|
|
|