[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] event shutdown/cleanup
I have a socket server which allocates memory for each connection. If there's an error on the socket it's easy for me to delete any memory associated with the connection. I also need to shutdown the eventbase from another thread which needs to close the listener socket, close all currently open connections and delete all memory associated with each connection.
If I call event_base_loopbreak and event_base_free to shutdown my event loop the loop breaks but it doesn't close any outstanding connections or give me a chance to delete memory associated with each connection. I am setting BEV_OPT_CLOSE_ON_FREE so I assume that the issue is that the bufferedevents are not getting freed when the event_base is. Is there any libevent functionality that would help or do I need to maintain a parallel data structure of current connections so I can call event_free() on each of them? event_base_foreach_event seems almost like the correct thing but the documentation explicitly says to not modify the events - I'm guessing that includes calling event_free().
Thanks-
John
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.