From 6a3893cece4eafbfef9c49dfe85e40ea09a8f277 Mon Sep 17 00:00:00 2001 From: fhanik Date: Fri, 13 Apr 2007 18:08:43 +0000 Subject: [PATCH] Use the remaining for the byte buffer as the capacity is the total capacity and not the limit git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@528570 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/http11/InternalNioOutputBuffer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http11/InternalNioOutputBuffer.java b/java/org/apache/coyote/http11/InternalNioOutputBuffer.java index c4f4d29a1..e54d2d279 100644 --- a/java/org/apache/coyote/http11/InternalNioOutputBuffer.java +++ b/java/org/apache/coyote/http11/InternalNioOutputBuffer.java @@ -788,8 +788,8 @@ public class InternalNioOutputBuffer if (socket.getBufHandler().getWriteBuffer().position() == socket.getBufHandler().getWriteBuffer().capacity()) { flushBuffer(); } - if (thisTime > socket.getBufHandler().getWriteBuffer().capacity() - socket.getBufHandler().getWriteBuffer().position()) { - thisTime = socket.getBufHandler().getWriteBuffer().capacity() - socket.getBufHandler().getWriteBuffer().position(); + if (thisTime > socket.getBufHandler().getWriteBuffer().remaining()) { + thisTime = socket.getBufHandler().getWriteBuffer().remaining(); } addToBB(b,start,thisTime); len = len - thisTime; -- 2.11.0