Libevent: how to close all open sockets on shutdown?
问题 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,