Skip to content

Commit 34f9370

Browse files
use cl.ID instead of pk.Connect.ClientIdentifier when looking for existing clients in inheritClientSession (#417)
* use cl.id instead of pk.Connect.ClientIdentifier which is client-supplied, when looking for existing clients in inheritClientSession * look for assigned client id explicitly * simpler implementation using just cl.ID --------- Co-authored-by: JB <[email protected]>
1 parent dc272d2 commit 34f9370

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ func (s *Server) validateConnect(cl *Client, pk packets.Packet) packets.Code {
560560
// connection ID. If clean is true, the state of any previously existing client
561561
// session is abandoned.
562562
func (s *Server) inheritClientSession(pk packets.Packet, cl *Client) bool {
563-
if existing, ok := s.Clients.Get(pk.Connect.ClientIdentifier); ok {
563+
if existing, ok := s.Clients.Get(cl.ID); ok {
564564
_ = s.DisconnectClient(existing, packets.ErrSessionTakenOver) // [MQTT-3.1.4-3]
565565
if pk.Connect.Clean || (existing.Properties.Clean && existing.Properties.ProtocolVersion < 5) { // [MQTT-3.1.2-4] [MQTT-3.1.4-4]
566566
s.UnsubscribeClient(existing)

0 commit comments

Comments
 (0)