Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Merge branch 'master' into dev
Dieser Commit ist enthalten in:
Commit
3a5ac6f037
@ -28,6 +28,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
|
import io.netty.channel.ChannelPipeline;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -110,11 +111,22 @@ public abstract class LegacyViaInjector implements ViaInjector {
|
|||||||
public void uninject() throws ReflectiveOperationException {
|
public void uninject() throws ReflectiveOperationException {
|
||||||
//TODO uninject connections
|
//TODO uninject connections
|
||||||
for (ChannelFuture future : injectedFutures) {
|
for (ChannelFuture future : injectedFutures) {
|
||||||
List<String> names = future.channel().pipeline().names();
|
// Default to first
|
||||||
ChannelHandler bootstrapAcceptor = null;
|
ChannelPipeline pipeline = future.channel().pipeline();
|
||||||
|
ChannelHandler bootstrapAcceptor = pipeline.first();
|
||||||
|
if (bootstrapAcceptor == null) {
|
||||||
|
Via.getPlatform().getLogger().info("Empty pipeline, nothing to uninject");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Pick best
|
// Pick best
|
||||||
for (String name : names) {
|
for (String name : pipeline.names()) {
|
||||||
ChannelHandler handler = future.channel().pipeline().get(name);
|
ChannelHandler handler = pipeline.get(name);
|
||||||
|
if (handler == null) {
|
||||||
|
Via.getPlatform().getLogger().warning("Could not get handler " + name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (ReflectionUtil.get(handler, "childHandler", ChannelInitializer.class) instanceof WrappedChannelInitializer) {
|
if (ReflectionUtil.get(handler, "childHandler", ChannelInitializer.class) instanceof WrappedChannelInitializer) {
|
||||||
bootstrapAcceptor = handler;
|
bootstrapAcceptor = handler;
|
||||||
@ -124,11 +136,6 @@ public abstract class LegacyViaInjector implements ViaInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootstrapAcceptor == null) {
|
|
||||||
// Default to first
|
|
||||||
bootstrapAcceptor = future.channel().pipeline().first();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ChannelInitializer<Channel> initializer = ReflectionUtil.get(bootstrapAcceptor, "childHandler", ChannelInitializer.class);
|
ChannelInitializer<Channel> initializer = ReflectionUtil.get(bootstrapAcceptor, "childHandler", ChannelInitializer.class);
|
||||||
if (initializer instanceof WrappedChannelInitializer) {
|
if (initializer instanceof WrappedChannelInitializer) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren