-
Notifications
You must be signed in to change notification settings - Fork 554
Description
I have tried various things and I cannot get the server to stop once its started other than to kill the app it was started from. I want to enable the server to allow a file upload then stop the server once I've uploaded that file. I assumed it would be as simple as:
server.stop()
This doesn't work, having looked at the source and checked some of the available variables, before stopping it if I check:
server.operating it is false
server.state is stopped
Even though the server is happily serving pages, it still says state is stopped, which in turn makes operating false. So when I call server.stop() the following line in HttpServerIO.swift prevents the server from stopping ...
public func stop() {
guard self.operating else { return }
Because of this I am unable to stop the server, I even tried making server an optional with
var server: HttpServer?
server = HttpServer()
then try to stop it
server!.stop()
server = nil
Even when it has been set to nil it is still serving pages, the only way I can get the server to stop is to kill the app. So my question is how do I stop the server on demand without killing my app?