Skip to content

Commit

Permalink
Merge pull request #422 from tigerlee/master
Browse files Browse the repository at this point in the history
Avoid to block thread while write to a nil channel
  • Loading branch information
ackleymi authored May 8, 2023
2 parents 07872e7 + 3ce9479 commit 199c332
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ func (s *session) EnqueueBytesAndSend(msg []byte) {
}

func (s *session) sendBytes(msg []byte) {
if s.messageOut == nil {
s.log.OnEventf("Failed to send: disconnected")
return
}

s.log.OnOutgoing(msg)
s.messageOut <- msg
s.stateTimer.Reset(s.HeartBtInt)
Expand Down

0 comments on commit 199c332

Please sign in to comment.