use packetwrapper#send refactor

This commit is contained in:
creeper123123321 2019-01-08 06:51:57 -02:00
parent 2553caf3fd
commit b4f69a6e8e
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
2 changed files with 16 additions and 4 deletions

View File

@ -94,11 +94,17 @@ public class VRDecodeHandler extends ByteToMessageDecoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (PipelineUtil.containsCause(cause, CancelException.class))
return;
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
super.exceptionCaught(ctx, cause);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
try (AutoCloseable ignored = user.createTaskListAndRunOnClose()) {
super.channelRead(ctx, msg);
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ProtocolInfo info = user.get(ProtocolInfo.class);

View File

@ -104,8 +104,14 @@ public class VREncodeHandler extends MessageToByteEncoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (PipelineUtil.containsCause(cause, CancelException.class))
return;
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
super.exceptionCaught(ctx, cause);
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
try (AutoCloseable ignored = user.createTaskListAndRunOnClose()) {
super.write(ctx, msg, promise);
}
}
}