Skip to content

Commit

Permalink
Update server version
Browse files Browse the repository at this point in the history
  • Loading branch information
mochi-co committed Feb 28, 2023
1 parent e4c76cc commit 44ce819
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

const (
Version = "2.2.4" // the current server version.
Version = "2.2.5" // the current server version.
defaultSysTopicInterval int64 = 1 // the interval between $SYS topic publishes
)

Expand Down Expand Up @@ -365,7 +365,7 @@ func (s *Server) attachClient(cl *Client, listener string) error {
if expire && atomic.LoadUint32(&cl.State.isTakenOver) == 0 {
cl.ClearInflights(math.MaxInt64, 0)
s.UnsubscribeClient(cl)
s.Clients.Delete(cl.ID) // [MQTT-4.1.0-2] ![MQTT-3.1.2-23] }
s.Clients.Delete(cl.ID) // [MQTT-4.1.0-2] ![MQTT-3.1.2-23]
}

return err
Expand Down Expand Up @@ -442,12 +442,11 @@ func (s *Server) inheritClientSession(pk packets.Packet, cl *Client) bool {
if pk.Connect.Clean || (existing.Properties.Clean && existing.Properties.ProtocolVersion < 5) { // [MQTT-3.1.2-4] [MQTT-3.1.4-4]
s.UnsubscribeClient(existing)
existing.ClearInflights(math.MaxInt64, 0)
atomic.StoreUint32(&existing.State.isTakenOver, 1)
return false // [MQTT-3.2.2-3]
atomic.StoreUint32(&existing.State.isTakenOver, 1) // only set isTakenOver after unsubscribe has occurred
return false // [MQTT-3.2.2-3]
}

atomic.StoreUint32(&existing.State.isTakenOver, 1)

if existing.State.Inflight.Len() > 0 {
cl.State.Inflight = existing.State.Inflight.Clone() // [MQTT-3.1.2-5]
if cl.State.Inflight.maximumReceiveQuota == 0 && cl.ops.capabilities.ReceiveMaximum != 0 {
Expand Down

0 comments on commit 44ce819

Please sign in to comment.