[dev][mod_wsgi] asynchronous extensions

Manlio Perillo manlio_perillo at libero.it
Wed Mar 5 01:17:44 MSK 2008

Igor Sysoev ha scritto:
> On Tue, Mar 04, 2008 at 01:30:07PM +0100, Manlio Perillo wrote:
>> 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.
>>> [...]
> [...]
> Next answers later.

Igor, thanks for the documentation!

I have solved most of the problems, and I have a working draft.

However I have found a problem, and unfortunately I'm not expert of 
epoll internals.

As I have written, I'm using libcurl as the HTTP client.

Here is the operations I do:
1) libcurl tells me that it is waiting for the socket to be writeable,
    and I call handle_write_event(self->c->write, 0)

    Since this is the first time that I see the socket I call
    ngx_get_connection and after this I call ngx_add_conn (if defined)

2) libcurl tells me to deregister the socket, and I call
    ngx_del_event(self->c->write, NGX_WRITE_EVENT, 0)

3) libcurl tells me that it is waiting for the socket to be readable,
    and I call ngx_handle_read_event(self->c->read, 0),
    but I get an error:
    epoll_ctl(EPOLL_CTL_ADD, 8) failed (17: File exists)

What I'm doing wrong?

Thanks  Manlio Perillo

More information about the nginx mailing list