mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-21 21:09:07 +02:00
Highlight what signals that the sup is running (which means the Connection is running because of UP/auto start)
This commit is contained in:
@@ -95,7 +95,7 @@ func (s *supervisor) loop() {
|
|||||||
case opStop:
|
case opStop:
|
||||||
s.handleStop(cmd)
|
s.handleStop(cmd)
|
||||||
case opStatus:
|
case opStatus:
|
||||||
cmd.reply <- (s.curStart != nil)
|
cmd.reply <- (s.isRunningInternal())
|
||||||
}
|
}
|
||||||
case res := <-s.runEnded:
|
case res := <-s.runEnded:
|
||||||
// Run ended on its own, without an explicit Stop.
|
// Run ended on its own, without an explicit Stop.
|
||||||
@@ -105,7 +105,7 @@ func (s *supervisor) loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *supervisor) handleStart(cmd lifecycleCmd) {
|
func (s *supervisor) handleStart(cmd lifecycleCmd) {
|
||||||
if s.curStart != nil {
|
if s.isRunningInternal() {
|
||||||
notify(cmd.done, errAlreadyRunning)
|
notify(cmd.done, errAlreadyRunning)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ func (s *supervisor) handleStop(cmd lifecycleCmd) {
|
|||||||
// error back to whoever asked to be notified of the start.
|
// error back to whoever asked to be notified of the start.
|
||||||
func (s *supervisor) finishRun(err error) {
|
func (s *supervisor) finishRun(err error) {
|
||||||
s.runCancel = nil
|
s.runCancel = nil
|
||||||
if s.curStart != nil {
|
if s.isRunningInternal() {
|
||||||
notify(s.curStart.done, err)
|
notify(s.curStart.done, err)
|
||||||
s.curStart = nil
|
s.curStart = nil
|
||||||
}
|
}
|
||||||
@@ -212,6 +212,10 @@ func (s *supervisor) isRunning() bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *supervisor) isRunningInternal() bool {
|
||||||
|
return s.curStart != nil
|
||||||
|
}
|
||||||
|
|
||||||
// stop enqueues a stop and blocks until the in-flight run is fully torn down.
|
// stop enqueues a stop and blocks until the in-flight run is fully torn down.
|
||||||
func (s *supervisor) stop() error {
|
func (s *supervisor) stop() error {
|
||||||
done := make(chan error, 1)
|
done := make(chan error, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user