Handle long-polling sockets when we are shutting down the server with SIGHUP better