Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paper-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ dependencies {
isTransitive = false
}
implementation("io.netty:netty-codec-haproxy:4.2.7.Final") // Add support for proxy protocol
implementation("io.netty:netty-transport-classes-io_uring:4.2.7.Final") // Add support for io_uring
implementation("io.netty:netty-transport-native-io_uring:4.2.7.Final:linux-x86_64")
implementation("io.netty:netty-transport-native-io_uring:4.2.7.Final:linux-aarch_64")
implementation("org.apache.logging.log4j:log4j-iostreams:2.25.2")
implementation("org.ow2.asm:asm-commons:9.9.1")
implementation("org.spongepowered:configurate-yaml:4.2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,21 @@
}

if (this.tickCount++ % 20 == 0) {
@@ -390,6 +_,7 @@
@@ -390,12 +_,13 @@
}

public void disconnect(final DisconnectionDetails details) {
+ this.preparing = false; // Spigot
if (this.channel == null) {
this.delayedDisconnect = details;
}

if (this.isConnected()) {
- this.channel.close().awaitUninterruptibly();
+ this.channel.close(); // We can't wait as this may be called from an event loop.
this.disconnectionDetails = details;
}
}
@@ -534,6 +_,14 @@
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/EventLoopGroupHolder.java
+++ b/net/minecraft/server/network/EventLoopGroupHolder.java
@@ -48,19 +_,39 @@
@@ -48,19 +_,63 @@
return LocalIoHandler.newFactory();
}
};
Expand All @@ -12,6 +12,20 @@
+ }
+ };
+ // Paper end - Unix domain socket support
+ // Paper start - io_uring transport support
+ private static final EventLoopGroupHolder IO_URING = new EventLoopGroupHolder("IO Uring", io.netty.channel.uring.IoUringSocketChannel.class, io.netty.channel.uring.IoUringServerSocketChannel.class) {
+ @Override
+ protected IoHandlerFactory ioHandlerFactory() {
+ return io.netty.channel.uring.IoUringIoHandler.newFactory();
+ }
+ };
+ private static final EventLoopGroupHolder IO_URING_UNIX_DOMAIN = new EventLoopGroupHolder("Unix Domain Socket", io.netty.channel.uring.IoUringDomainSocketChannel.class, io.netty.channel.uring.IoUringServerDomainSocketChannel.class) {
+ @Override
+ protected IoHandlerFactory ioHandlerFactory() {
+ return io.netty.channel.uring.IoUringIoHandler.newFactory();
+ }
+ };
+ // Paper end - io_uring transport support
private final String type;
private final Class<? extends Channel> channelCls;
private final Class<? extends ServerChannel> serverChannelCls;
Expand All @@ -29,6 +43,16 @@
return KQUEUE;
}

+ // Paper start - io_uring transport support
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().network.useIoUringTransport) {
+ if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
+ return IO_URING_UNIX_DOMAIN;
+ } else {
+ return IO_URING;
+ }
+ }
+ // Paper end - io_uring transport support
+
if (Epoll.isAvailable()) {
- return EPOLL;
+ // Paper start - Unix domain socket support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@ public boolean isProxyOnlineMode() {
}
}

public Network network;

public class Network extends ConfigurationPart {
public boolean useIoUringTransport = false;

@PostProcess
private void postProcess() {
if (!this.useIoUringTransport) return;

if (!io.netty.channel.uring.IoUring.isAvailable()) {
LOGGER.error("Linux io_uring transport is enabled but is not supported on this system. Disabling io_uring...");
this.useIoUringTransport = false;
}

if (!net.minecraft.server.MinecraftServer.getServer().useNativeTransport()) {
LOGGER.error("Linux io_uring transport is enabled but native transports are disabled in server.properties. Disabling io_uring...");
this.useIoUringTransport = false;
}
}

}

public Console console;

public class Console extends ConfigurationPart {
Expand Down
Loading