fix LookupPacketInfoByType for undecoable
This commit is contained in:
@@ -80,6 +80,7 @@ func (c *Conn) OnLoginTick(_ LoginTick) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
slog.Debug("logintick recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet))
|
||||||
err = c.Fire(packet)
|
err = c.Fire(packet)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -135,6 +136,7 @@ func (c *Conn) ActivateReceiveRoutine() (chSending <-chan any) {
|
|||||||
ch <- err
|
ch <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
slog.Debug("recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet))
|
||||||
ch <- 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) {
|
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 {
|
for _, p := range proto_generated.Packets {
|
||||||
if reflect.TypeOf(p.Type) == reflect.TypeOf(packet) {
|
if reflect.TypeOf(p.Type) == reflect.TypeOf(packet) {
|
||||||
return p, true
|
return p, true
|
||||||
|
|||||||
Reference in New Issue
Block a user