mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 09:59:15 +00:00
Bump netty to 4.2.4 & Add io_uring, kqueue support (#449)
* Bump netty to 4.2.3 * Upload config * Update config comments * Fix model detection * Switch to system properties * kqueue support * Bump to latest * Fix build --------- Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Leaf - Bump netty to 4.2.x
|
||||
|
||||
package org.dreeam.leaf;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum NetworkIoModel {
|
||||
|
||||
IO_URING("io_uring"),
|
||||
KQUEUE("kqueue"),
|
||||
EPOLL("epoll"),
|
||||
NIO("nio");
|
||||
|
||||
private final String name;
|
||||
|
||||
NetworkIoModel(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static NetworkIoModel fromName(String name) {
|
||||
if (name == null) return EPOLL;
|
||||
return switch (name.toLowerCase(Locale.ROOT)) {
|
||||
case "io_uring" -> IO_URING;
|
||||
case "kqueue" -> KQUEUE;
|
||||
case "epoll" -> EPOLL;
|
||||
default -> NIO;
|
||||
};
|
||||
}
|
||||
|
||||
public static NetworkIoModel fromProperty() {
|
||||
final String name = System.getProperty("Leaf.native-transport-type");
|
||||
if (name == null) return EPOLL;
|
||||
return switch (name.toLowerCase(Locale.ROOT)) {
|
||||
case "io_uring" -> IO_URING;
|
||||
case "kqueue" -> KQUEUE;
|
||||
case "epoll" -> EPOLL;
|
||||
default -> NIO;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user