You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/08/02 08:39:49 UTC
svn commit: r1509556 - in
/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods:
AsyncByteConsumer.java AsyncCharConsumer.java
Author: olegk
Date: Fri Aug 2 06:39:48 2013
New Revision: 1509556
URL: http://svn.apache.org/r1509556
Log:
HTTPASYNC-40: Cannot suspend input when using AsyncByteConsumer / AsyncCharConsumer
Modified:
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java?rev=1509556&r1=1509555&r2=1509556&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java Fri Aug 2 06:39:48 2013
@@ -63,11 +63,8 @@ public abstract class AsyncByteConsumer<
protected final void onContentReceived(
final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
Asserts.notNull(this.bbuf, "Byte buffer");
- for (;;) {
- final int bytesRead = decoder.read(this.bbuf);
- if (bytesRead <= 0) {
- break;
- }
+ final int bytesRead = decoder.read(this.bbuf);
+ if (bytesRead > 0) {
this.bbuf.flip();
onByteReceived(this.bbuf, ioctrl);
this.bbuf.clear();
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java?rev=1509556&r1=1509555&r2=1509556&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java Fri Aug 2 06:39:48 2013
@@ -78,11 +78,8 @@ public abstract class AsyncCharConsumer<
protected final void onContentReceived(
final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
Asserts.notNull(this.bbuf, "Byte buffer");
- for (;;) {
- final int bytesRead = decoder.read(this.bbuf);
- if (bytesRead <= 0) {
- break;
- }
+ final int bytesRead = decoder.read(this.bbuf);
+ if (bytesRead > 0) {
this.bbuf.flip();
final boolean completed = decoder.isCompleted();
CoderResult result = this.chardecoder.decode(this.bbuf, this.cbuf, completed);