Archived
0

fix: более корректное отображение ошибок

This commit is contained in:
2018-08-18 22:08:43 +03:00
parent b66cd18e14
commit c2aa48f14f

View File

@@ -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();
packet.readSelf(netStream);
log.debug("Known packet: {}:{}", state.name(), packet.toString());
out.add(packet);
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());
}
}
}
}