Highlight what signals that the sup is running (which means the Connection is running because of UP/auto start)

This commit is contained in:
riccardom
2026-06-18 13:25:23 +02:00
parent ff98105212
commit 0e8fd22f36

View File

@@ -95,7 +95,7 @@ func (s *supervisor) loop() {
case opStop:
s.handleStop(cmd)
case opStatus:
cmd.reply <- (s.curStart != nil)
cmd.reply <- (s.isRunningInternal())
}
case res := <-s.runEnded:
// Run ended on its own, without an explicit Stop.
@@ -105,7 +105,7 @@ func (s *supervisor) loop() {
}
func (s *supervisor) handleStart(cmd lifecycleCmd) {
if s.curStart != nil {
if s.isRunningInternal() {
notify(cmd.done, errAlreadyRunning)
return
}
@@ -145,7 +145,7 @@ func (s *supervisor) handleStop(cmd lifecycleCmd) {
// error back to whoever asked to be notified of the start.
func (s *supervisor) finishRun(err error) {
s.runCancel = nil
if s.curStart != nil {
if s.isRunningInternal() {
notify(s.curStart.done, err)
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.
func (s *supervisor) stop() error {
done := make(chan error, 1)