Merge pull request #15 from Arikatsu/development

Fix infinite loading when `filterLoopingPackets` is true
This commit is contained in:
Hiro
2023-12-02 19:40:23 +02:00
committed by GitHub

View File

@@ -2,6 +2,7 @@ package emu.lunarcore.server.game;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import ch.qos.logback.classic.Logger;
import emu.lunarcore.LunarCore; import emu.lunarcore.LunarCore;
import emu.lunarcore.game.account.Account; import emu.lunarcore.game.account.Account;
import emu.lunarcore.game.player.Player; import emu.lunarcore.game.player.Player;
@@ -127,11 +128,9 @@ public class GameSession {
// Log packet // Log packet
if (LunarCore.getConfig().getLogOptions().packets) { if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(opcode)) { if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(opcode))) {
return; logPacket("RECV", opcode, data);
} }
logPacket("RECV", opcode, data);
} }
// Handle // Handle
@@ -156,11 +155,9 @@ public class GameSession {
// Log // Log
if (LunarCore.getConfig().getLogOptions().packets) { if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(packet.getCmdId())) { if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(packet.getCmdId()))) {
return; logPacket("RECV", packet.getCmdId(), packet.getData());
} }
logPacket("SEND", packet.getCmdId(), packet.getData());
} }
} }
@@ -175,11 +172,9 @@ public class GameSession {
// Log // Log
if (LunarCore.getConfig().getLogOptions().packets) { if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(cmdId)) { if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(cmdId))) {
return; logPacket("RECV", cmdId, null);
} }
logPacket("SEND", cmdId, null);
} }
} }
} }