Skip to content

Commit

Permalink
Clarify writability in Netty4HttpPipeliningHandler (#91982)
Browse files Browse the repository at this point in the history
TIL we don't really mean that the physical channel is writable in these
loops, so this commit adds a couple of comments to record that lesson.
  • Loading branch information
DaveCTurner authored Nov 29, 2022
1 parent 788750b commit 4764134
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ private void doWrite(ChannelHandlerContext ctx, Netty4ChunkedHttpResponse readyR
combiner.add((Future<Void>) first);
currentChunkedWrite = new ChunkedWrite(combiner, promise, readyResponse);
if (enqueueWrite(ctx, readyResponse, first)) {
// we were able to write out the first chunk directly, try writing out subsequent chunks until the channel becomes unwritable
// We were able to write out the first chunk directly, try writing out subsequent chunks until the channel becomes unwritable.
// NB "writable" means there's space in the downstream ChannelOutboundBuffer, we aren't trying to saturate the physical channel.
while (ctx.channel().isWritable()) {
if (writeChunk(ctx, combiner, readyResponse.body())) {
finishChunkedWrite();
Expand Down Expand Up @@ -280,6 +281,7 @@ private boolean doFlush(ChannelHandlerContext ctx) throws IOException {
return false;
}
while (channel.isWritable()) {
// NB "writable" means there's space in the downstream ChannelOutboundBuffer, we aren't trying to saturate the physical channel.
WriteOperation currentWrite = queuedWrites.poll();
if (currentWrite == null) {
doWriteQueued(ctx);
Expand Down

0 comments on commit 4764134

Please sign in to comment.