public static void ConnectOtherGatewayServer(ClientBase client, int gatewayID, int clientID) { GatewayInfo info = CenterGlobal.GetFreeGateway(gatewayID); if (info != null) { ReConnectGatewayPacket pkg = new ReConnectGatewayPacket(); pkg.ClientID = clientID; pkg.IP = info.IP; pkg.Port = info.Port; client.SendTcp(pkg); } else { //TODO: 通知客户端服务器繁忙 log.Warn("所有网关服务器满载 请增开新的网关服务器"); ClientMsgPacket pkg = new ClientMsgPacket(); pkg.MsgFlag = MsgFlag.NoneGateway; //ServerBusiesPacket pkg = new ServerBusiesPacket(); //pkg.ClientID = clientID; client.SendTcp(pkg); } }
public static LogicServerConnector GetFreeLogicServer(GatewayClient client) { LogicServerConnector connector = LogicServerMgr[m_freeID]; if (connector != null && connector.Fulled == false) { return connector; } LogicServerConnector connect = LogicServerMgr.SelectSingle(conn => conn.Fulled == false); if (connect != null) { m_freeID = connect.ID; connector = connect; return connect; } else if(connector == null) { //TODO: 通知客户端逻辑服务器已满 稍候登陆 ClientMsgPacket pkg = new ClientMsgPacket(); pkg.MsgFlag = MsgFlag.NoneLogic; client.SendTcp(pkg); log.Warn("所有逻辑服务器满载 请增开新的逻辑服务器"); } return connector; }
public static void Send2Center(GamePacket pkg, ClientBase client) { if (CenterServer.Socket.Connected) { CenterServer.SendTCP(pkg); } else { //TODO: 通知客户端无可用中心服务器 if (client != null) { ClientMsgPacket p = new ClientMsgPacket(); p.MsgFlag = MsgFlag.NoneCenter; client.SendTcp(p); } } }