Skip to content

Commit 84c0c51

Browse files
authored
fix: don't activate protocol state timeout until after initial state (#1263)
Fixes #1262 Signed-off-by: Aurora Gaffney <aurora@blinklabs.io>
1 parent d95b170 commit 84c0c51

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

protocol/protocol.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ func (p *Protocol) recvLoop() {
524524

525525
func (p *Protocol) stateLoop(ch <-chan protocolStateTransition) {
526526
var transitionTimer *time.Timer
527+
var initialStateSet bool
527528

528529
setState := func(s State) {
529530
// Disable any previous state transition timer
@@ -573,6 +574,11 @@ func (p *Protocol) stateLoop(ch <-chan protocolStateTransition) {
573574
}
574575
}
575576

577+
// Don't activate timeouts on initial protocol state
578+
if !initialStateSet {
579+
return
580+
}
581+
576582
// Set timeout for state transition
577583
if p.config.StateMap[s].Timeout > 0 {
578584
transitionTimer = time.NewTimer(
@@ -587,7 +593,9 @@ func (p *Protocol) stateLoop(ch <-chan protocolStateTransition) {
587593
return transitionTimer.C
588594
}
589595

596+
// Set initial state
590597
setState(p.config.InitialState)
598+
initialStateSet = true
591599

592600
for {
593601
select {

0 commit comments

Comments
 (0)