[dev] synchronous write
Manlio Perillo
manlio_perillo at libero.it
Mon Oct 22 15:40:51 MSD 2007
Igor Sysoev ha scritto:
> On Mon, Oct 22, 2007 at 01:11:21PM +0200, Manlio Perillo wrote:
>
> [...]
>>> Yes, it will work. However, you should use the following cycle:
>>>
>>> ngx_blocking(self->r->connection->fd);
>>>
>>> do {
>>> rc = ngx_http_output_filter(self->r, &out);
>>> } while (rc == NGX_AGAIN);
>>>
>>> ngx_nonblocking(self->r->connection->fd);
>>>
>> That's unexpected, I have assumed that with socket in blocking mode
>> ngx_http_output_filter never returns NGX_AGAIN.
>
> No, write() to a socket in blocking mode may send less bytes than you ask.
>
Ok, thanks.
I was assuming that NGX_AGAIN is returned only when the socket sets the
EWOULDBLOCK/EAGAIN error.
Manlio Perillo
More information about the nginx
mailing list