[dev] synchronous write

Manlio Perillo manlio_perillo at libero.it
Tue Oct 16 23:33:00 MSD 2007


Igor Sysoev ha scritto:
> On Tue, Oct 16, 2007 at 12:32:53PM +0200, Manlio Perillo wrote:
> 
>> 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.
>>
>> Fortunately not so many WSGI applications use the write callable, and it 
>> is going to be removed from the next revision of WSGI.
> 
> In general socket API does not allow to say exactly whether data was
> sent completely to a client. The single way is close() with SO_LINGER.
> 

No, the problem is not really whether data was sent completely to a peer 
(it is sufficient that the data is in OS buffer)

My problem is how to handle NGX_AGAIN in the write callable, since I 
can't return control to Nginx (and setting the event handlers).

As an example (pseudo code):
   while ((rc = ngx_http_output_filter(r, &out) == NGX_AGAIN) {
       sleep(...)


But this does not works.



Thanks   Manlio Perillo






More information about the nginx mailing list