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:
parent
3b8da7db3f
commit
5bec0c352a
@ -202,7 +202,6 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
|
||||
discard(null);
|
||||
return;
|
||||
}
|
||||
boolean needsFlush;
|
||||
while (channel.isWritable()) {
|
||||
if (currentWrite == null) {
|
||||
currentWrite = queue.poll();
|
||||
@ -211,7 +210,6 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
|
||||
if (currentWrite == null) {
|
||||
break;
|
||||
}
|
||||
needsFlush = true;
|
||||
final PendingWrite currentWrite = this.currentWrite;
|
||||
final Object pendingMessage = currentWrite.msg;
|
||||
|
||||
@ -306,9 +304,9 @@ public class ChunkedWriteHandler extends ChannelHandlerAdapter {
|
||||
this.currentWrite = null;
|
||||
}
|
||||
|
||||
if (needsFlush) {
|
||||
ctx.flush();
|
||||
}
|
||||
// Always need to flush
|
||||
ctx.flush();
|
||||
|
||||
if (!channel.isActive()) {
|
||||
discard(new ClosedChannelException());
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user