Skip to content

Commit

Permalink
Merge pull request #15 from Arikatsu/development
Browse files Browse the repository at this point in the history
Fix infinite loading when `filterLoopingPackets` is true
  • Loading branch information
Hiro420 authored Dec 2, 2023
2 parents a49f245 + 0a09cd7 commit 5f9e66d
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/main/java/emu/lunarcore/server/game/GameSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.net.InetSocketAddress;

import ch.qos.logback.classic.Logger;
import emu.lunarcore.LunarCore;
import emu.lunarcore.game.account.Account;
import emu.lunarcore.game.player.Player;
Expand Down Expand Up @@ -127,11 +128,9 @@ public void onMessage(ByteBuf packet) {

// Log packet
if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(opcode)) {
return;
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(opcode))) {
logPacket("RECV", opcode, data);
}

logPacket("RECV", opcode, data);
}

// Handle
Expand All @@ -156,11 +155,9 @@ public void send(BasePacket packet) {

// Log
if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(packet.getCmdId())) {
return;
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(packet.getCmdId()))) {
logPacket("RECV", packet.getCmdId(), packet.getData());
}

logPacket("SEND", packet.getCmdId(), packet.getData());
}
}

Expand All @@ -175,11 +172,9 @@ public void send(int cmdId) {

// Log
if (LunarCore.getConfig().getLogOptions().packets) {
if (LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(cmdId)) {
return;
}

logPacket("SEND", cmdId, null);
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(cmdId))) {
logPacket("RECV", cmdId, null);
}
}
}
}
Expand Down

0 comments on commit 5f9e66d

Please sign in to comment.