[Libevent-users] evhttp: how to detect a client that closed
the connection?
Frank Denis
libevent at pureftpd.org
Tue Mar 4 04:52:11 EST 2008
Le Tue, Mar 04, 2008 at 09:18:42AM +0300, Donghui Wen ecrivait :
> You can use evhttp_connection_set_closecb to set up the callback.
Hello,
The callback set with evhttp_connection_set_closecb() is not called before
you pushed up some reply.
I'm working on a bosh-like XMPP/HTTP proxy and the issue is this scenario:
- Client connects through HTTP, this creates a new evhttp_connection
- the callback for the URI sets up a new connection to the XMPP server, but
does not reply anything to the HTTP request yet
- back to the libevent event loop
- now, the HTTP client drops the connection => no callback is called.
On the other hand, that scenario perfectly works:
- Client connects through HTTP, this creates a new evhttp connection
- sooner or later, evhttp_send_reply() is called to push the reply
- once the reply has been sent, the callback set with
evhttp_connection_set_closecb() is fired as expected.
More information about the Libevent-users
mailing list