Archiviert
13
0

Merge pull request 'IO_Uring support' (#12) from io_uring into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: SteamWar/Paper#12
Dieser Commit ist enthalten in:
Lixfel 2024-03-14 09:08:36 +01:00
Commit 32ff11c890

Datei anzeigen

@ -0,0 +1,55 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Wed, 13 Mar 2024 18:23:22 +0100
Subject: [PATCH] IO_Uring support
diff --git a/build.gradle.kts b/build.gradle.kts
index fb98936bb8a5488db75d676c5bcb4060597fbbf8..2e803f7231b66323373c16e0cbf70e2405b1ed59 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -31,6 +31,7 @@ dependencies {
runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output)
implementation("io.netty:netty-codec-haproxy:4.1.87.Final") // Paper - Add support for proxy protocol
+ implementation("io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.24.Final:linux-x86_64")
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.4")
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 44d99e89226adb6234b9405f25ac9dab9bd84297..6674e461e9668449686369d1e535ed372bd9240b 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -23,6 +23,9 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.incubator.channel.uring.IOUring;
+import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
+import io.netty.incubator.channel.uring.IOUringServerSocketChannel;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timeout;
import io.netty.util.Timer;
@@ -56,6 +59,9 @@ public class ServerConnectionListener {
public static final LazyLoadedValue<EpollEventLoopGroup> SERVER_EPOLL_EVENT_GROUP = new LazyLoadedValue<>(() -> {
return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
+ public static final LazyLoadedValue<IOUringEventLoopGroup> SERVER_IOURING_EVENT_GROUP = new LazyLoadedValue<>(() -> {
+ return new IOUringEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
+ });
final MinecraftServer server;
public volatile boolean running;
private final List<ChannelFuture> channels = Collections.synchronizedList(Lists.newArrayList());
@@ -89,7 +95,11 @@ public class ServerConnectionListener {
Class oclass;
LazyLoadedValue lazyinitvar;
- if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
+ if (IOUring.isAvailable() && this.server.isEpollEnabled()) {
+ oclass = IOUringServerSocketChannel.class;
+ lazyinitvar = ServerConnectionListener.SERVER_IOURING_EVENT_GROUP;
+ ServerConnectionListener.LOGGER.info("Using io_uring channel type");
+ } else if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class;
} else {