Dependency update; re-use Thread.MAX_PRIORITY for Spigot; other network optimizations

This commit is contained in:
Camotoy 2021-08-31 19:57:56 -04:00
parent 7fe7dc1d70
commit 0069566803
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 10 additions and 6 deletions

View file

@ -118,7 +118,8 @@ public class GeyserSpigotInjector extends GeyserInjector {
initChannel.invoke(childHandler, ch); 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)) .localAddress(LocalAddress.ANY))
.bind() .bind()
.syncUninterruptibly(); .syncUninterruptibly();

View file

@ -115,7 +115,7 @@
<dependency> <dependency>
<groupId>com.github.CloudburstMC.Protocol</groupId> <groupId>com.github.CloudburstMC.Protocol</groupId>
<artifactId>bedrock-v448</artifactId> <artifactId>bedrock-v448</artifactId>
<version>6ce2f6e</version> <version>6b48673</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -169,7 +169,7 @@
<dependency> <dependency>
<groupId>com.github.GeyserMC</groupId> <groupId>com.github.GeyserMC</groupId>
<artifactId>PacketLib</artifactId> <artifactId>PacketLib</artifactId>
<version>86c9c38</version> <version>9d4b476</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

View file

@ -838,7 +838,7 @@ public class GeyserSession implements CommandSender {
// This issue could be mitigated down the line by preventing Bungee from setting compression // 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.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; internalConnect = true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1237,8 +1237,11 @@ public class GeyserSession implements CommandSender {
if (!closed && this.downstream != null) { if (!closed && this.downstream != null) {
Channel channel = this.downstream.getChannel(); Channel channel = this.downstream.getChannel();
if (channel == null) { if (channel == null) {
// Channel is set to null when downstream is disconnected - there is a short window for this to happen // Channel is only null before the connection has initialized
// as downstream doesn't call GeyserSession#disconnect connector.getLogger().warning("Tried to send a packet to the Java server too early!");
if (connector.getConfig().isDebugMode()) {
Thread.dumpStack();
}
return; return;
} }