Skip to content

Commit

Permalink
Only rollback Inflight if QoS > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevop committed Jan 14, 2024
1 parent 0be86e0 commit 44eadc8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,10 @@ func (s *Server) publishToClient(cl *Client, sub packets.Subscription, pk packet
default:
atomic.AddInt64(&s.Info.MessagesDropped, 1)
cl.ops.hooks.OnPublishDropped(cl, pk)
cl.State.Inflight.Delete(out.PacketID) // packet was dropped due to irregular circumstances, so rollback inflight.
cl.State.Inflight.IncreaseSendQuota()
if out.FixedHeader.Qos > 0 {
cl.State.Inflight.Delete(out.PacketID) // packet was dropped due to irregular circumstances, so rollback inflight.
cl.State.Inflight.IncreaseSendQuota()
}
return out, packets.ErrPendingClientWritesExceeded
}

Expand Down

0 comments on commit 44eadc8

Please sign in to comment.