This commit is contained in:
creeper123123321 2018-12-22 18:07:58 -02:00
parent caf6ab22ce
commit 8735230d86
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
3 changed files with 21 additions and 22 deletions

View File

@ -94,13 +94,14 @@ public class VRDecodeHandler extends ByteToMessageDecoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
if (user.isActive()) {
Iterator<Runnable> iterator = user.getPostProcessingTasks().iterator();
while (iterator.hasNext()) {
iterator.next().run();
iterator.remove();
if (PipelineUtil.containsCause(cause, CancelException.class)) {
if (user.isActive()) {
Runnable runnable;
while ((runnable = user.getPostProcessingTasks().poll()) != null) {
runnable.run();
}
}
return;
}
super.exceptionCaught(ctx, cause);
}
@ -109,13 +110,11 @@ public class VRDecodeHandler extends ByteToMessageDecoder {
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
super.channelRead(ctx, msg);
if (user.isActive()) {
Iterator<Runnable> iterator = user.getPostProcessingTasks().iterator();
while (iterator.hasNext()) {
iterator.next().run();
iterator.remove();
Runnable runnable;
while ((runnable = user.getPostProcessingTasks().poll()) != null) {
runnable.run();
}
}
// todo implement to other platforms
}
@Override

View File

@ -104,13 +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 (user.isActive()) {
Iterator<Runnable> iterator = user.getPostProcessingTasks().iterator();
while (iterator.hasNext()) {
iterator.next().run();
iterator.remove();
if (PipelineUtil.containsCause(cause, CancelException.class)) {
if (user.isActive()) {
Runnable runnable;
while ((runnable = user.getPostProcessingTasks().poll()) != null) {
runnable.run();
}
}
return;
}
super.exceptionCaught(ctx, cause);
}
@ -119,10 +120,9 @@ public class VREncodeHandler extends MessageToByteEncoder {
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
super.write(ctx, msg, promise);
if (user.isActive()) {
Iterator<Runnable> iterator = user.getPostProcessingTasks().iterator();
while (iterator.hasNext()) {
iterator.next().run();
iterator.remove();
Runnable runnable;
while ((runnable = user.getPostProcessingTasks().poll()) != null) {
runnable.run();
}
}
}

View File

@ -88,7 +88,7 @@ public class VRUserConnection extends UserConnection {
@Override
public void sendRawPacketAfterProcessing(ByteBuf packet) {
ByteBuf copy = packet.alloc().buffer();
ByteBuf copy = Unpooled.buffer();
try {
Type.VAR_INT.write(copy, PacketWrapper.PASSTHROUGH_ID);
} catch (Exception e) {