From cf9c1f946add66c079096338dfe41beea14ceadc Mon Sep 17 00:00:00 2001 From: Ian Barfield Date: Fri, 28 Mar 2014 13:34:31 -0400 Subject: [PATCH] Deleting redundant needsFlush boolean Motivation: In ChunkedWriteHandler, there is a redundant variable that servers no purpose. It implies that under some conditions you might not want to flush. Modifications: Removed the variable and the if condition that read it. The boolean was always true so just removing the if statement was fine. Result: Slightly less misleading code. --- .../java/io/netty/handler/stream/ChunkedWriteHandler.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java b/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java index 201df47ab6..72442ac1be 100644 --- a/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java +++ b/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java @@ -203,7 +203,6 @@ public class ChunkedWriteHandler discard(null); return; } - boolean needsFlush; while (channel.isWritable()) { if (currentWrite == null) { currentWrite = queue.poll(); @@ -212,7 +211,6 @@ public class ChunkedWriteHandler if (currentWrite == null) { break; } - needsFlush = true; final PendingWrite currentWrite = this.currentWrite; final Object pendingMessage = currentWrite.msg; @@ -307,9 +305,9 @@ public class ChunkedWriteHandler this.currentWrite = null; } - if (needsFlush) { - ctx.flush(); - } + // Always need to flush + ctx.flush(); + if (!channel.isActive()) { discard(new ClosedChannelException()); return;