Loading...

dev-extensions@lists.mozilla.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: PR_Read intercept Boris Zbarsky Thu Jun 24 20:00:17 2010

On 6/24/10 8:54 AM, [EMAIL PROTECTED] wrote:
But there is a problem here  - if the original pPR_Read once returns -1
with PR_WOULD_BLOCK_ERROR then each following call to pPR_Read ends up
with the same -1 and PR_WOULD_BLOCK_ERROR error. Why can't we download
all the data from the socket ?

Because it's a non-blocking socket. You have already read all the data that was available. There won't be any more data until some comes in over the network. If you really need _all_ the data, you have to wait for that to happen.

Note that a number of network responses have infinite length (JPEG push, for example).

I assume there is some kind of wait
function that blocks executions and expects for some event to get
signalled or something else.

We don't block execution while waiting for network data. We go and do something else, then get notified when there's more data available.

-Boris
_______________________________________________
dev-extensions mailing list
[EMAIL PROTECTED]
https://lists.mozilla.org/listinfo/dev-extensions