You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2011/04/14 12:59:14 UTC

svn commit: r1092121 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java

Author: sebb
Date: Thu Apr 14 10:59:14 2011
New Revision: 1092121

URL: http://svn.apache.org/viewvc?rev=1092121&view=rev
Log:
HTTPCORE-254 Erratic results from metrics

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=1092121&r1=1092120&r2=1092121&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Thu Apr 14 10:59:14 2011
@@ -1,5 +1,7 @@
 Changes since 4.1
 
+* [HTTPCORE-254]: Erratic results from metrics (sebb)
+
 * [HTTPCORE-242]: Fixed NPE in AsyncNHttpClientHandler caused by an early response to an
   entity enclosing request.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=1092121&r1=1092120&r2=1092121&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java Thu Apr 14 10:59:14 2011
@@ -184,7 +184,11 @@ public abstract class AbstractSessionInp
         // If the remaining capacity is big enough, read directly from the
         // underlying input stream bypassing the buffer.
         if (len > this.minChunkLimit) {
-            return this.instream.read(b, off, len);
+            int read = this.instream.read(b, off, len);
+            if (read > 0) {
+                this.metrics.incrementBytesTransferred(read);
+            }
+            return read;
         } else {
             // otherwise read to the buffer first
             while (!hasBufferedData()) {