Should fix any ClosedConnection output

This commit is contained in:
Myles 2016-03-02 20:19:47 +00:00
parent 785f0664da
commit e8cc25baad
2 changed files with 14 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import us.myles.ViaVersion.ConnectionInfo;
import us.myles.ViaVersion.transformers.IncomingTransformer;
import us.myles.ViaVersion.util.PacketUtil;
import java.nio.channels.ClosedChannelException;
import java.util.List;
public class ViaDecodeHandler extends ByteToMessageDecoder {
@ -44,10 +45,12 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (!(cause.getCause().getCause() instanceof CancelException)) {
if (!(cause.getCause() instanceof CancelException)) {
if (!(cause instanceof CancelException)) {
System.out.println("throwing");
if (!(cause.getCause().getCause() instanceof CancelException)
&& !(cause.getCause().getCause() instanceof ClosedChannelException)) {
if (!(cause.getCause() instanceof CancelException)
&& !(cause.getCause() instanceof ClosedChannelException)) {
if (!(cause instanceof CancelException)
&& !(cause instanceof ClosedChannelException)) {
if (cause instanceof Exception)
throw (Exception) cause;
}

View File

@ -10,6 +10,7 @@ import us.myles.ViaVersion.util.PacketUtil;
import us.myles.ViaVersion.util.ReflectionUtil;
import java.lang.reflect.Constructor;
import java.nio.channels.ClosedChannelException;
public class ViaEncodeHandler extends MessageToByteEncoder {
private final ConnectionInfo info;
@ -71,10 +72,12 @@ public class ViaEncodeHandler extends MessageToByteEncoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (!(cause.getCause().getCause() instanceof CancelException)) {
if (!(cause.getCause() instanceof CancelException)) {
if (!(cause instanceof CancelException)) {
System.out.println("throwing");
if (!(cause.getCause().getCause() instanceof CancelException)
&& !(cause.getCause().getCause() instanceof ClosedChannelException)) {
if (!(cause.getCause() instanceof CancelException)
&& !(cause.getCause() instanceof ClosedChannelException)) {
if (!(cause instanceof CancelException)
&& !(cause instanceof ClosedChannelException)) {
if (cause instanceof Exception)
throw (Exception) cause;
}