I would like to be able to call server.stop() even while it is starting. Currently, it will throw when I try to do this, with no practical way of telling before making the actual call.
The use case is simple: I want to install a SIGINT handler that gracefully stops the server. If it triggers while starting the server, I would like it to abort the start process, and apply the stop process as usual, before calling the server.start() callback with an error.
Note that it should also work if stopped while in the implicit initializing state.
I would like to be able to call
server.stop()even while it is starting. Currently, it will throw when I try to do this, with no practical way of telling before making the actual call.The use case is simple: I want to install a
SIGINThandler that gracefully stops the server. If it triggers while starting the server, I would like it to abort the start process, and apply the stop process as usual, before calling theserver.start()callback with an error.Note that it should also work if stopped while in the implicit
initializingstate.