geforkt von Mirrors/Velocity
Notify on read-timeout instead of emitting exception
Dieser Commit ist enthalten in:
Ursprung
45574ce952
Commit
07b775d892
@ -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 {
|
||||||
|
try {
|
||||||
if (sessionHandler == null) {
|
if (sessionHandler == null) {
|
||||||
// No session handler available, do nothing
|
// No session handler available, do nothing
|
||||||
ReferenceCountUtil.release(msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
if (sessionHandler.beforeHandle()) {
|
if (sessionHandler.beforeHandle()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,8 +137,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (association != null) {
|
if (association != null) {
|
||||||
|
if (cause instanceof ReadTimeoutException) {
|
||||||
|
logger.error("{}: read timed out", association);
|
||||||
|
} else {
|
||||||
logger.error("{}: exception encountered", association, cause);
|
logger.error("{}: exception encountered", association, cause);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren