Skip to content

Commit

Permalink
fix: only count server prots towards PACKET_GROUP_END in live decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-Kris committed Dec 11, 2024
1 parent bb5e655 commit 3429e38
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions proxy/src/main/kotlin/net/rsprox/proxy/plugin/DecodingSession.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,27 @@ public class DecodingSession(
val size = BinaryStream.decodeSize(buffer, prot)
val payload = buffer.readSlice(size)
val remainingBytesInPacketGroup = session.getRemainingBytesInPacketGroup()
if (direction == StreamDirection.CLIENT_TO_SERVER) {
val packet =
plugin.decodeClientPacket(
prot.opcode,
payload.toJagByteBuf(),
session,
)
return listOf(
DirectionalPacket(
direction,
prot,
packet,
),
)
}
val packet =
when (direction) {
StreamDirection.CLIENT_TO_SERVER -> {
plugin.decodeClientPacket(
prot.opcode,
payload.toJagByteBuf(),
session,
)
}
StreamDirection.SERVER_TO_CLIENT -> {
plugin.decodeServerPacket(
prot.opcode,
payload.toJagByteBuf(),
session,
)
}
}
plugin.decodeServerPacket(
prot.opcode,
payload.toJagByteBuf(),
session,
)
if (remainingBytesInPacketGroup != null && remainingBytesInPacketGroup > 0) {
val read = buffer.readerIndex() - marker
session.setBytesConsumed((session.getBytesConsumed() ?: 0) + read)
Expand Down

0 comments on commit 3429e38

Please sign in to comment.