Skip to content

Commit

Permalink
use default instead of a timer
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrosKyriakakis committed Jan 31, 2024
1 parent bb33c92 commit 21384e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,18 @@ func (s *session) persist(seqNum int, msgBytes []byte) error {

func (s *session) sendQueued() {
var (
blocked bool
sent bool
indexBlocked int
)

for i, msgBytes := range s.toSend {
blocked = s.sendBytes(msgBytes)
if blocked {
sent = s.sendBytes(msgBytes)
if !sent {
indexBlocked = i
break
}
}
if blocked {
if !sent {
s.toSend = s.toSend[indexBlocked:]
s.notifyMessageOut()
return
Expand All @@ -390,11 +390,11 @@ func (s *session) sendBytes(msg []byte) bool {
}

select {
case <-time.After(5 * time.Millisecond):
return true
case s.messageOut <- msg:
s.log.OnOutgoing(msg)
s.stateTimer.Reset(s.HeartBtInt)
return true
default:
return false
}
}
Expand Down

0 comments on commit 21384e6

Please sign in to comment.