[dev] synchronous write

Igor Sysoev is at rambler-co.ru
Mon Oct 22 14:05:22 MSD 2007


On Sun, Oct 21, 2007 at 11:57:25AM +0200, Manlio Perillo wrote:

> Manlio Perillo ha scritto:
> >Hi.
> >
> >The mod_wsgi implementation is almost complete.
> >The only feature that I have to implement is the write callable:
> >http://www.python.org/dev/peps/pep-0333/#the-write-callable
> >
> >
> >The problem is that the WSGI spec *requires* the passed-in string to be 
> >completely sent to the client when the write function returns.
> >
> >Is this possible with Nginx?
> >It does not matter that the entire process is blocked.
> >
> 
> Igor, do you thing that setting temporarily the socket to blocking mode 
> can be a solution?
> 
>     out.buf = b;
>     out.next = NULL;
> 
>     b->pos = data;
>     b->last = data + len;
> 
>     b->memory = 1;
>     b->flush = 1;
> 
>     ngx_blocking(self->r->connection->fd);
>     rc = ngx_http_output_filter(self->r, &out);
>     ngx_nonblocking(self->r->connection->fd);
> 
> 
> I have done some tests and it seems to work.

No, this completely kill the idea of nginx - a worker will be blocked.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list