You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2013/04/25 13:36:16 UTC

[jira] [Updated] (HTTPASYNC-40) Cannot suspend input when using AsyncByteConsumer

     [ https://issues.apache.org/jira/browse/HTTPASYNC-40?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPASYNC-40:
---------------------------------------

    Fix Version/s: 4.0-beta4
    
> Cannot suspend input when using AsyncByteConsumer
> -------------------------------------------------
>
>                 Key: HTTPASYNC-40
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-40
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-beta3
>            Reporter: Bodo Junglas
>            Priority: Minor
>             Fix For: 4.0-beta4
>
>
> When inheriting from org.apache.http.nio.client.methods.AsyncByteConsumer a suspendInput on the iocrlt is unreliable. The core of the problem is this loop:
> for (;;) {
>             int bytesRead = decoder.read(this.bbuf);
>             if (bytesRead <= 0) {
>                 break;
>             }
>             this.bbuf.flip();
>             onByteReceived(this.bbuf, ioctrl);
>             this.bbuf.clear();
>         }
> I.e. while there is anything to be read it is delivered to onByteReceived non-stop (eat or die).
> Unluckily a situation when a server delivers its data so fast that decoder.read never returns 0 is usually also a situation when the client might want to suspend the input for a moment.
> Workaround: Use AbstractAsyncResponseConsumer instead.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org