Skip to content

Commit 695c11e

Browse files
authored
Merge pull request #223 from blinklabs-io/fix/protocol-state-transition-timer-shutdown
fix: stop protocol state transition timer on shutdown
2 parents e6a93ec + 8b1e784 commit 695c11e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

protocol/protocol.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ func (p *Protocol) Start() {
107107
close(p.sendStateQueueChan)
108108
close(p.recvReadyChan)
109109
close(p.sendReadyChan)
110+
if p.stateTransitionTimer != nil {
111+
// Stop timer and drain channel
112+
if !p.stateTransitionTimer.Stop() {
113+
<-p.stateTransitionTimer.C
114+
}
115+
p.stateTransitionTimer = nil
116+
}
110117
}()
111118
// Set initial state
112119
p.setState(p.config.InitialState)

0 commit comments

Comments
 (0)