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.
This commit is contained in:
Ian Barfield 2014-03-28 13:34:31 -04:00 committed by Norman Maurer
parent 3b8da7db3f
commit 5bec0c352a

View File

@ -202,7 +202,6 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
discard(null); discard(null);
return; return;
} }
boolean needsFlush;
while (channel.isWritable()) { while (channel.isWritable()) {
if (currentWrite == null) { if (currentWrite == null) {
currentWrite = queue.poll(); currentWrite = queue.poll();
@ -211,7 +210,6 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
if (currentWrite == null) { if (currentWrite == null) {
break; break;
} }
needsFlush = true;
final PendingWrite currentWrite = this.currentWrite; final PendingWrite currentWrite = this.currentWrite;
final Object pendingMessage = currentWrite.msg; final Object pendingMessage = currentWrite.msg;
@ -306,9 +304,9 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
this.currentWrite = null; this.currentWrite = null;
} }
if (needsFlush) { // Always need to flush
ctx.flush(); ctx.flush();
}
if (!channel.isActive()) { if (!channel.isActive()) {
discard(new ClosedChannelException()); discard(new ClosedChannelException());
return; return;