[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] evhttp issue



Hi,

We're using libevent 1.4.12 to implement a long-polling/comet-type server. Web browsers send a request and we keep the connection open until we have some data for them (which may be a long time later). The browser then repeats the request. We do not use 'Connection: close' as we want to keep some data until the browser does navigate away (we don't want our close callback to be called until then). 

I posted here several months ago that we found that we needed to call (the private function) evhttp_connection_start_detectclose() otherwise our close callback would never get called in the case of the browser navigating away before we sent back data. This all works, except that occasionally it appears that our close callback gets called twice for a disconnect, the second time with invalid data.

Are we using libevent incorrectly? I'm concerned that we had to patch the code to be able to call evhttp_connection_start_detectclose() and perhaps it's our direct use of it that's causing this intermittent problem.

Thanks,
Mark