Skip to content

Commit c83230c

Browse files
authored
Merge pull request #531 from shipa988/multi-dynamic-session-stop-deadlock
Multi dynamic session stop deadlock
2 parents 04aa323 + bc299df commit c83230c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

session.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type session struct {
3535
stateTimer *internal.EventTimer
3636
peerTimer *internal.EventTimer
3737
sentReset bool
38+
stopOnce sync.Once
3839

3940
targetDefaultApplVerID string
4041

@@ -76,7 +77,10 @@ func (s *session) connect(msgIn <-chan fixIn, msgOut chan<- []byte) error {
7677
type stopReq struct{}
7778

7879
func (s *session) stop() {
79-
s.admin <- stopReq{}
80+
//stop once
81+
s.stopOnce.Do(func() {
82+
s.admin <- stopReq{}
83+
})
8084
}
8185

8286
type waitChan <-chan interface{}

0 commit comments

Comments
 (0)