Skip to content

Commit

Permalink
Merge pull request #223 from blinklabs-io/fix/protocol-state-transiti…
Browse files Browse the repository at this point in the history
…on-timer-shutdown

fix: stop protocol state transition timer on shutdown
  • Loading branch information
agaffney authored Apr 5, 2023
2 parents e6a93ec + 8b1e784 commit 695c11e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions protocol/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ func (p *Protocol) Start() {
close(p.sendStateQueueChan)
close(p.recvReadyChan)
close(p.sendReadyChan)
if p.stateTransitionTimer != nil {
// Stop timer and drain channel
if !p.stateTransitionTimer.Stop() {
<-p.stateTransitionTimer.C
}
p.stateTransitionTimer = nil
}
}()
// Set initial state
p.setState(p.config.InitialState)
Expand Down

0 comments on commit 695c11e

Please sign in to comment.