mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-03 22:47:38 +01:00
337ca7f887
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: 70038c91 Revert "#2714: Remove unnecessary throws in ServerConnector" 39ef20b2 #2716: Don't attempt to send kick packet during handshake phase 74a6aa32 #2714: Remove unnecessary throws in ServerConnector c7984070 Misc dependency update
56 lines
2.3 KiB
Diff
56 lines
2.3 KiB
Diff
From c38cefc98046895ed5e3e905b529ef45da5df6d6 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Mon, 25 Nov 2019 19:54:06 +0000
|
|
Subject: [PATCH] Cache session exceptions
|
|
|
|
|
|
diff --git a/api/src/main/java/io/github/waterfallmc/waterfall/utils/FastException.java b/api/src/main/java/io/github/waterfallmc/waterfall/utils/FastException.java
|
|
new file mode 100644
|
|
index 00000000..11e103cb
|
|
--- /dev/null
|
|
+++ b/api/src/main/java/io/github/waterfallmc/waterfall/utils/FastException.java
|
|
@@ -0,0 +1,19 @@
|
|
+package io.github.waterfallmc.waterfall.utils;
|
|
+
|
|
+// This is basically a copy of QuietException
|
|
+public class FastException extends RuntimeException {
|
|
+
|
|
+ public FastException(String message) {
|
|
+ super(message);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public synchronized Throwable initCause(Throwable cause) {
|
|
+ return this;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public synchronized Throwable fillInStackTrace() {
|
|
+ return this;
|
|
+ }
|
|
+}
|
|
diff --git a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
|
|
index ac99d02c..0c1ecfb8 100644
|
|
--- a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
|
|
+++ b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
|
|
@@ -32,6 +32,7 @@ public class QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
|
|
/*========================================================================*/
|
|
private final Random random = new Random();
|
|
private final Cache<InetAddress, QuerySession> sessions = CacheBuilder.newBuilder().expireAfterWrite( 30, TimeUnit.SECONDS ).build();
|
|
+ private static io.github.waterfallmc.waterfall.utils.FastException cachedNoSessionException = new io.github.waterfallmc.waterfall.utils.FastException("No Session!");
|
|
|
|
private void writeShort(ByteBuf buf, int s)
|
|
{
|
|
@@ -96,7 +97,7 @@ public class QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
|
|
QuerySession session = sessions.getIfPresent( msg.sender().getAddress() );
|
|
if ( session == null || session.getToken() != challengeToken )
|
|
{
|
|
- throw new IllegalStateException( "No session!" );
|
|
+ throw cachedNoSessionException; // Waterfall
|
|
}
|
|
|
|
// Waterfall start
|
|
--
|
|
2.24.0
|
|
|