Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Netty 4.2.0.Alpha5
Dieser Commit ist enthalten in:
Ursprung
623415e051
Commit
ae12c478ca
@ -3,7 +3,7 @@ configurate3 = "3.7.3"
|
|||||||
configurate4 = "4.1.2"
|
configurate4 = "4.1.2"
|
||||||
flare = "2.0.1"
|
flare = "2.0.1"
|
||||||
log4j = "2.22.1"
|
log4j = "2.22.1"
|
||||||
netty = "4.2.0.Alpha4"
|
netty = "4.2.0.Alpha5"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
indra-publishing = "net.kyori.indra.publishing:2.0.6"
|
indra-publishing = "net.kyori.indra.publishing:2.0.6"
|
||||||
|
@ -45,6 +45,7 @@ import io.netty.channel.uring.IoUringIoHandler;
|
|||||||
import io.netty.channel.uring.IoUringServerSocketChannel;
|
import io.netty.channel.uring.IoUringServerSocketChannel;
|
||||||
import io.netty.channel.uring.IoUringSocketChannel;
|
import io.netty.channel.uring.IoUringSocketChannel;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumerates the supported transports for Velocity.
|
* Enumerates the supported transports for Velocity.
|
||||||
@ -53,36 +54,37 @@ public enum TransportType {
|
|||||||
NIO("NIO", NioServerSocketChannel::new,
|
NIO("NIO", NioServerSocketChannel::new,
|
||||||
NioSocketChannel::new,
|
NioSocketChannel::new,
|
||||||
NioDatagramChannel::new,
|
NioDatagramChannel::new,
|
||||||
NioIoHandler.newFactory()),
|
NioIoHandler::newFactory),
|
||||||
EPOLL("epoll", EpollServerSocketChannel::new,
|
EPOLL("epoll", EpollServerSocketChannel::new,
|
||||||
EpollSocketChannel::new,
|
EpollSocketChannel::new,
|
||||||
EpollDatagramChannel::new,
|
EpollDatagramChannel::new,
|
||||||
EpollIoHandler.newFactory()),
|
EpollIoHandler::newFactory),
|
||||||
KQUEUE("kqueue", KQueueServerSocketChannel::new,
|
KQUEUE("kqueue", KQueueServerSocketChannel::new,
|
||||||
KQueueSocketChannel::new,
|
KQueueSocketChannel::new,
|
||||||
KQueueDatagramChannel::new,
|
KQueueDatagramChannel::new,
|
||||||
KQueueIoHandler.newFactory()),
|
KQueueIoHandler::newFactory),
|
||||||
IO_URING("io_uring", IoUringServerSocketChannel::new,
|
IO_URING("io_uring", IoUringServerSocketChannel::new,
|
||||||
IoUringSocketChannel::new,
|
IoUringSocketChannel::new,
|
||||||
IoUringDatagramChannel::new,
|
IoUringDatagramChannel::new,
|
||||||
IoUringIoHandler.newFactory());
|
IoUringIoHandler::newFactory);
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
final ChannelFactory<? extends ServerSocketChannel> serverSocketChannelFactory;
|
final ChannelFactory<? extends ServerSocketChannel> serverSocketChannelFactory;
|
||||||
final ChannelFactory<? extends SocketChannel> socketChannelFactory;
|
final ChannelFactory<? extends SocketChannel> socketChannelFactory;
|
||||||
final ChannelFactory<? extends DatagramChannel> datagramChannelFactory;
|
final ChannelFactory<? extends DatagramChannel> datagramChannelFactory;
|
||||||
final IoHandlerFactory ioHandlerFactory;
|
final Supplier<IoHandlerFactory> ioHandlerFactorySupplier;
|
||||||
|
volatile IoHandlerFactory ioHandlerFactory;
|
||||||
|
|
||||||
TransportType(final String name,
|
TransportType(final String name,
|
||||||
final ChannelFactory<? extends ServerSocketChannel> serverSocketChannelFactory,
|
final ChannelFactory<? extends ServerSocketChannel> serverSocketChannelFactory,
|
||||||
final ChannelFactory<? extends SocketChannel> socketChannelFactory,
|
final ChannelFactory<? extends SocketChannel> socketChannelFactory,
|
||||||
final ChannelFactory<? extends DatagramChannel> datagramChannelFactory,
|
final ChannelFactory<? extends DatagramChannel> datagramChannelFactory,
|
||||||
final IoHandlerFactory ioHandlerFactory) {
|
final Supplier<IoHandlerFactory> ioHandlerFactorySupplier) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.serverSocketChannelFactory = serverSocketChannelFactory;
|
this.serverSocketChannelFactory = serverSocketChannelFactory;
|
||||||
this.socketChannelFactory = socketChannelFactory;
|
this.socketChannelFactory = socketChannelFactory;
|
||||||
this.datagramChannelFactory = datagramChannelFactory;
|
this.datagramChannelFactory = datagramChannelFactory;
|
||||||
this.ioHandlerFactory = ioHandlerFactory;
|
this.ioHandlerFactorySupplier = ioHandlerFactorySupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +92,17 @@ public enum TransportType {
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new event loop group for the given type.
|
||||||
|
*
|
||||||
|
* @param type the type of event loop group to create
|
||||||
|
* @return the event loop group
|
||||||
|
*/
|
||||||
public EventLoopGroup createEventLoopGroup(final Type type) {
|
public EventLoopGroup createEventLoopGroup(final Type type) {
|
||||||
|
if (this.ioHandlerFactory == null) {
|
||||||
|
this.ioHandlerFactory = this.ioHandlerFactorySupplier.get();
|
||||||
|
}
|
||||||
|
assert this.ioHandlerFactory != null;
|
||||||
return new MultiThreadIoEventLoopGroup(
|
return new MultiThreadIoEventLoopGroup(
|
||||||
0, createThreadFactory(this.name, type), this.ioHandlerFactory);
|
0, createThreadFactory(this.name, type), this.ioHandlerFactory);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren