13
0
geforkt von Mirrors/Velocity

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