Skip to content

Commit

Permalink
HTTPCORE-727 (follow-up): async HTTP/1.1 protocol handler fails to co…
Browse files Browse the repository at this point in the history
…unt bytes transferred while flushing session buffer when writing out a message head or suspending session output.
  • Loading branch information
ok2c committed Nov 2, 2022
1 parent 6023622 commit 8fabd3d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,10 @@ void commitMessageHead(
}
outgoingMessageWriter.reset();
if (flushMode == FlushMode.IMMEDIATE) {
outbuf.flush(ioSession);
final int bytesWritten = outbuf.flush(ioSession);
if (bytesWritten > 0) {
outTransportMetrics.incrementBytesTransferred(bytesWritten);
}
}
ioSession.setEvent(EventMask.WRITE);
} finally {
Expand Down Expand Up @@ -479,7 +482,10 @@ void suspendSessionOutput() throws IOException {
ioSession.getLock().lock();
try {
if (outbuf.hasData()) {
outbuf.flush(ioSession);
final int bytesWritten = outbuf.flush(ioSession);
if (bytesWritten > 0) {
outTransportMetrics.incrementBytesTransferred(bytesWritten);
}
} else {
ioSession.clearEvent(SelectionKey.OP_WRITE);
}
Expand Down

0 comments on commit 8fabd3d

Please sign in to comment.