Skip to content

Commit

Permalink
fix: catch exception in NettyPacketUdpDecoder and print it only in de…
Browse files Browse the repository at this point in the history
…bug mode

#397
  • Loading branch information
Apehum committed Mar 31, 2024
1 parent 2c93513 commit b023124
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- 1.20.3 and 1.20.4 support
- Fixed stacktrace spam on bad packets [#397](https://github.com/plasmoapp/plasmo-voice/issues/397)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.socket.DatagramPacket;
import io.netty.handler.codec.MessageToMessageDecoder;
import su.plo.voice.BaseVoice;
import su.plo.voice.proto.packets.udp.PacketUdp;
import su.plo.voice.proto.packets.udp.PacketUdpCodec;

Expand All @@ -13,6 +14,11 @@

public final class NettyPacketUdpDecoder extends MessageToMessageDecoder<DatagramPacket> {

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
BaseVoice.DEBUG_LOGGER.log("Failed to decode packet", cause);
}

@Override
protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception {
byte[] bytes = ByteBufUtil.getBytes(packet.content());
Expand All @@ -21,11 +27,6 @@ protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Obj
if (!packetUdp.isPresent()) return;
PacketUdp decoded = packetUdp.get();

// if (System.currentTimeMillis() - decoded.getTimestamp() > PacketUdp.TTL) {
// System.out.println(System.currentTimeMillis() - decoded.getTimestamp());
// return;
// }

out.add(new NettyPacketUdp(packet, bytes, decoded));
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Version
targetJavaVersion=8
mavenGroup=su.plo.voice
buildVersion=2.0.8
buildVersion=2.0.9

# Gradle args
org.gradle.jvmargs=-Xmx2048M
Expand Down
2 changes: 1 addition & 1 deletion proxy/changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Fixed a bug where an AES key was not reset properly after a backend restart
- Fixed stacktrace spam on bad packets [#397](https://github.com/plasmoapp/plasmo-voice/issues/397)
2 changes: 1 addition & 1 deletion server/changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- [Paper] SuperVanish/PremiumVanish integration with show and hide events
- Fixed stacktrace spam on bad packets [#397](https://github.com/plasmoapp/plasmo-voice/issues/397)
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pluginManagement {
}

plugins {
val egtVersion = "0.2.2"
val egtVersion = "0.3.0"
id("gg.essential.defaults") version egtVersion
id("gg.essential.multi-version.root") version egtVersion
}
Expand Down

0 comments on commit b023124

Please sign in to comment.