Skip to content

Commit

Permalink
Terminate the goroutine on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
braams authored and sobomax committed May 28, 2024
1 parent b738651 commit d85f369
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sippy/sip_transaction_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ func NewSipTransactionManager(config sippy_conf.Config, call_map sippy_types.Cal
}
go func() {
for {
time.Sleep(32 * time.Second)
self.rCachePurge()
select {
case <-self.shutdown_chan:
return
case <-time.After(32 * time.Second):
self.rCachePurge()
}
}
}()
return self, nil
Expand Down Expand Up @@ -730,7 +734,7 @@ func (self *sipTransactionManager) tserver_replace(old_tid, new_tid *sippy_heade
}

func (self *sipTransactionManager) Shutdown() {
self.shutdown_chan <- 1
close(self.shutdown_chan)
}

func (self *sipTransactionManager) beforeResponseSent(resp sippy_types.SipResponse) {
Expand Down

0 comments on commit d85f369

Please sign in to comment.