I have created a simple HTTP proxy using libevent. It can be shutdown by sending it a SIGHUP
signal which is caught by the signal handler. The shutdown function calls event_base_loopexit
, frees structures and other heap allocations and exits.
The problem is if a SIGHUP
is caught when a connection is open. I need to be able to close the socket, ideally invoking the same close function that is called when a close event is caught.
Is there a correct or standard way to do this?
At the moment, the only thing I can think of is to keep a linked list of connections and simply iterate through this on shutdown, closing each in turn.