Skip to content

Commit

Permalink
Merge pull request #44 from andy89923/fix/term-panic
Browse files Browse the repository at this point in the history
fix: check evtCh nil before ticker send to channel
  • Loading branch information
ianchen0119 committed Apr 2, 2024
2 parents 705e50d + 6f29546 commit 4a89dd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/forwarder/perio/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ func (pg *PERIOGroup) newTicker(wg *sync.WaitGroup, evtCh chan Event) error {
select {
case <-ticker.C:
logger.PerioLog.Debugf("ticker[%v] timeout", period)
evtCh <- Event{
eType: TYPE_PERIO_TIMEOUT,
period: period,
// If the UPF had terminating, the evtCh would be nil
if evtCh != nil {
evtCh <- Event{
eType: TYPE_PERIO_TIMEOUT,
period: period,
}
}
case <-pg.stopCh:
logger.PerioLog.Infof("ticker[%v] Stopped", period)
Expand Down

0 comments on commit 4a89dd2

Please sign in to comment.