[dev][mod_wsgi] asynchronous extensions

Manlio Perillo manlio_perillo at libero.it
Tue Mar 4 15:30:07 MSK 2008


Manlio Perillo ha scritto:
> Hi.
> 
> Its time to add asynchronous extensions to the WSGI module.
> 
> I'm developing a WSGI application where I need to talk with a web 
> service on the Internet, so it is *very* important to use an 
> asynchronous HTTP client.
 >
> [...]
 >

Some more detailed questions:
1) Can I use NGX_READ_EVENT and NGX_WRITE_EVENT as bit masks?
    As an example:
    flags = NGX_READ_EVENT | NGX_WRITE_EVENT
    if (flags & NGX_READ_EVENT) {...}

2) What's the meaning of active, disabled, ready and oneshot attributes
    in the event structure?

    And what about the write attribute?

3) Should I set event->ready = 0 after I have handled an event?
    Are there other things that I need to do in the event handler?
    Note that I do not need to write or read from the socket.

4) The handle_write_event function remove the event when
    wev->active && wev->ready.

    What's the rationale?

5) It seems that the event module does not allow me to register an
    event for both read and write notifications.

    This can be a problem for me, since I have to manage two callbacks...
    I have to check.

    Moreover there is a difference in how events are handled in the
    select and poll module, as an example.

    For the select module it is the passed in event object that is
    posted, and I have no way to know if the socket is ready for reading
    or writing.

    With the poll module it is the event->data->read and/or
    event->data->write that is posted.

    What's the rationale?
    I'm not an expert, but why the select module does not do the same as
    the poll module?

6) The event module assumes that the event data is the connection
    structure.
    What should I do if I need to keep more data?

    As an example, in my case I need to store the peer connection but
    also the http request.




Thanks  Manlio Perillo






More information about the nginx mailing list