fix LookupPacketInfoByType for undecoable
This commit is contained in:
@@ -80,6 +80,7 @@ func (c *Conn) OnLoginTick(_ LoginTick) (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
slog.Debug("logintick recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet))
|
||||
err = c.Fire(packet)
|
||||
return
|
||||
}
|
||||
@@ -135,6 +136,7 @@ func (c *Conn) ActivateReceiveRoutine() (chSending <-chan any) {
|
||||
ch <- err
|
||||
return
|
||||
}
|
||||
slog.Debug("recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet))
|
||||
ch <- packet
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,13 @@ func LookUpTypeByPacketInfoAndCopyType(direction proto_base.Direction, state pro
|
||||
}
|
||||
|
||||
func LookupPacketInfoByType(packet proto_base.EncodeDecodeAble) (p proto_base.PacketInfo, ok bool) {
|
||||
undecodedPacket, isUndecoable := packet.(*UnCodablePacket)
|
||||
if isUndecoable {
|
||||
p = proto_base.PacketInfo{Type: &UnCodablePacket{}, Name: "un_codable", Direction: undecodedPacket.Direction, State: proto_base.Handshaking, PacketId: -1, ProtocolVersion: -1}
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
for _, p := range proto_generated.Packets {
|
||||
if reflect.TypeOf(p.Type) == reflect.TypeOf(packet) {
|
||||
return p, true
|
||||
|
||||
Reference in New Issue
Block a user