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); }
private void SendAndResponse(PacketRequest reqPacket, Action<PacketResponse> actionOnReceived) { SendPacket(reqPacket, (p) => { return reqPacket.SeqNo == PacketResponse.GetSeqNo(p); }, (s, p) => { PacketResponse packet = new PacketResponse(p); packet.SkipHeader(); actionOnReceived(packet); }); }
public override StreamBuffer Clone() { PacketResponse packet = new PacketResponse(); packet.Write(Buffer); packet.ResetReadIndex(); packet.ResetWriteIndex(); packet.Read(ReadBytes); return packet; }