rework module shutdown process to cancel module context in defer

This commit is contained in:
Joel Wetzell
2026-05-27 20:50:33 -05:00
parent 52ca801fbd
commit 0b494fce91
21 changed files with 197 additions and 216 deletions
+2 -2
View File
@@ -168,6 +168,7 @@ func (scs *SIPCallServer) Start(ctx context.Context, inputHandler common.InputHa
}
<-scs.ctx.Done()
scs.logger.Debug("done")
return nil
}
@@ -251,12 +252,11 @@ func (scs *SIPCallServer) Output(ctx context.Context, payload any) error {
func (scs *SIPCallServer) Stop() {
if scs.cancel != nil {
scs.cancel()
defer scs.cancel()
}
scs.uaMu.Lock()
defer scs.uaMu.Unlock()
if scs.ua != nil {
scs.ua.Close()
}
scs.logger.Debug("done")
}