private void OnClosed(Session session) { if (_svrInfo == null) return; _svrInfo.Status = ServerStatus.Inactivate; Logger.Write(LogType.Info, 2, "GameServer({0}) disconnected.", _svrInfo.Uid); _svrInfo = null; }
private void OnSS_Register_Req(PacketRequest reqPacket) { PacketResponse resPacket = new PacketResponse(reqPacket); Int32 serverUid = reqPacket.GetInt32(); _svrInfo = ServerCatalog.Items.Find(v => v.Uid == serverUid); if (_svrInfo == null) resPacket.ResultCodeNo = ResultCode.InvalidUid; else { resPacket.ResultCodeNo = ResultCode.Ok; _svrInfo.Status = ServerStatus.Activate; Logger.Write(LogType.Info, 2, "GameServer({0}) registered.", serverUid); } SendPacket(resPacket); }
public static void Refresh() { Items.Clear(); using (DBCommand cmd = SystemDB.NewCommand()) { cmd.CommandText.Append("select uid, worldid, servertype, servername, system_ipaddress, listen_ipaddress, listen_portno"); cmd.CommandText.Append(" from t_listserver;"); MySqlDataReader reader = cmd.Query(); while (reader.Read()) { Items.Add(new ServerInfo() { Uid = reader.GetInt32(0), WorldId = reader.GetInt32(1), ServerType = (ServerType)reader.GetInt32(2), ServerName = reader.GetString(3), SystemIpAddress = reader.GetString(4), ListenIpAddress = reader.GetString(5), ListenPortNo = reader.GetInt32(6), Status = ServerStatus.Inactivate, Traffic = 0 }); } } MyServerInfo = null; foreach (var info in Items) { if (info.Uid == Aegis.Starter.ServerID) { MyServerInfo = info; break; } } }
private void OnAccepted(Session session) { _svrInfo = null; }