From 0069566803bf14ba2c8116ffc9f2d56da88afcc2 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 31 Aug 2021 19:57:56 -0400 Subject: [PATCH] Dependency update; re-use Thread.MAX_PRIORITY for Spigot; other network optimizations --- .../geysermc/platform/spigot/GeyserSpigotInjector.java | 3 ++- connector/pom.xml | 4 ++-- .../connector/network/session/GeyserSession.java | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java index 14065c52e..5b6e259f5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -118,7 +118,8 @@ public class GeyserSpigotInjector extends GeyserInjector { initChannel.invoke(childHandler, ch); } }) - .group(new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser Spigot connection thread"))) + // Set to MAX_PRIORITY as MultithreadEventLoopGroup#newDefaultThreadFactory which DefaultEventLoopGroup implements does by default + .group(new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser Spigot connection thread", Thread.MAX_PRIORITY))) .localAddress(LocalAddress.ANY)) .bind() .syncUninterruptibly(); diff --git a/connector/pom.xml b/connector/pom.xml index 6b955ca21..81c9acdf8 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -115,7 +115,7 @@ com.github.CloudburstMC.Protocol bedrock-v448 - 6ce2f6e + 6b48673 compile @@ -169,7 +169,7 @@ com.github.GeyserMC PacketLib - 86c9c38 + 9d4b476 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 7d500ef20..bfa9af7cf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -838,7 +838,7 @@ public class GeyserSession implements CommandSender { // This issue could be mitigated down the line by preventing Bungee from setting compression downstream.setFlag(BuiltinFlags.USE_ONLY_DIRECT_BUFFERS, connector.getPlatformType() == PlatformType.BUNGEECORD); - downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), true); + downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress()); internalConnect = true; } catch (Exception e) { e.printStackTrace(); @@ -1237,8 +1237,11 @@ public class GeyserSession implements CommandSender { if (!closed && this.downstream != null) { Channel channel = this.downstream.getChannel(); if (channel == null) { - // Channel is set to null when downstream is disconnected - there is a short window for this to happen - // as downstream doesn't call GeyserSession#disconnect + // Channel is only null before the connection has initialized + connector.getLogger().warning("Tried to send a packet to the Java server too early!"); + if (connector.getConfig().isDebugMode()) { + Thread.dumpStack(); + } return; }