Avoid writing two times the same message in case channelWritabilityChanged event is called during a write.
Motivation: ChunkedWriteHandler.doFlush is called twice from the same write if the channelWritabilityChanged event is invoked during the write. The buffer is already written so no extra data is sent on the socket but it causes the "promise already done" exception to be thrown. This error happens only when the message is not ChunkedInput. Modification: Clear out the currentWrite reference before the ctx.write call, such that next time when the method is invoked the same object is not used twice. Result: Fixes #7819
This commit is contained in:
parent
cd4594d292
commit
8d78893a76
@ -299,8 +299,8 @@ public class ChunkedWriteHandler extends ChannelDuplexHandler {
|
|||||||
ctx.flush();
|
ctx.flush();
|
||||||
requiresFlush = false;
|
requiresFlush = false;
|
||||||
} else {
|
} else {
|
||||||
ctx.write(pendingMessage, currentWrite.promise);
|
|
||||||
this.currentWrite = null;
|
this.currentWrite = null;
|
||||||
|
ctx.write(pendingMessage, currentWrite.promise);
|
||||||
requiresFlush = true;
|
requiresFlush = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user