3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Notify on read-timeout instead of emitting exception

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-03-17 19:44:22 -04:00
Ursprung 45574ce952
Commit 07b775d892

Datei anzeigen

@ -31,6 +31,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.EventLoop;
import io.netty.handler.codec.haproxy.HAProxyMessage;
import io.netty.handler.timeout.ReadTimeoutException;
import io.netty.util.ReferenceCountUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@ -96,13 +97,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
try {
if (sessionHandler == null) {
// No session handler available, do nothing
ReferenceCountUtil.release(msg);
return;
}
try {
if (sessionHandler.beforeHandle()) {
return;
}
@ -137,8 +137,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
}
if (association != null) {
if (cause instanceof ReadTimeoutException) {
logger.error("{}: read timed out", association);
} else {
logger.error("{}: exception encountered", association, cause);
}
}
ctx.close();
}