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

[Libevent-users] Freeing a closed persistent evhttp_connection



Hello,

Where do I free a persistent evhttp_connection after it has been closed? 

In my code, I have a cache of evhttp_connections to possibly different hosts. These connections are reused for multiple requests to the same hosts. At some point, these hosts may send back a "Connection: close" header, at which point the evhttp_connection will be "reset" by libevent. I know there is a close callback, but if I try to free the connection there, I get an infinite loop (evhttp_connection_free internally calls the close callback again). In the request's response callback, request->evcon is NULL if the connection has been closed. So when/where are you supposed to call evhttp_connection_free?

Thanks,

Mukul Majmudar