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 2a4999b6b8
commit cf9c1f946a

View File

@ -203,7 +203,6 @@ public class ChunkedWriteHandler
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();
@ -212,7 +211,6 @@ public class ChunkedWriteHandler
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;
@ -307,9 +305,9 @@ public class ChunkedWriteHandler
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;