oort/cmdctrl.go
func (o *Server) Exit() error {
	o.cmdCtrlLock.Lock()
	defer o.cmdCtrlLock.Unlock()
	if o.stopped {
		o.backend.Stop()
		defer o.shutdownFinished()
		return nil
	}
	close(o.ch)
	o.backend.StopListenAndServe()
	o.backend.Wait()
	o.backend.Stop()
	o.stopped = true
	defer o.shutdownFinished()
	return nil
}
func (o *Server) Exit() error {
	o.cmdCtrlLock.Lock()
	defer o.cmdCtrlLock.Unlock()
	if o.stopped {
		o.backend.Stop()
		defer o.shutdownFinished()
		return nil
	}
	close(o.ch)
	o.backend.StopListenAndServe()
	o.backend.Wait()
	o.backend.Stop()
	o.stopped = true
	defer o.shutdownFinished()
	return nil
}
// Exit the backend and shutdown all listeners.
// Closes the ShutdownComplete chan when finsihed.