fix: более корректное отображение ошибок
This commit is contained in:
@@ -51,13 +51,19 @@ public class PacketDecoder extends ByteToMessageDecoder {
|
||||
Class<? extends CSPacket> packetClass = state.getClientSidePacket(packetId);
|
||||
if (packetClass == null) {
|
||||
log.warn("Unknown packet: {}:0x{}", state.name(), hexPacketId);
|
||||
in.skipBytes(packetSize - rb);
|
||||
in.skipBytes(in.readableBytes());
|
||||
} else {
|
||||
netStream.setDataSize(packetSize - rb);
|
||||
CSPacket packet = packetClass.newInstance();
|
||||
try {
|
||||
packet.readSelf(netStream);
|
||||
log.debug("Known packet: {}:{}", state.name(), packet.toString());
|
||||
out.add(packet);
|
||||
} catch (Exception e) {
|
||||
log.warn("Known packet: {}:{}. But throw exception. See debug log.", state.name(), packet.getClass().getSimpleName());
|
||||
log.debug("Read packet", e);
|
||||
in.skipBytes(in.readableBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user