Fix client id assignment
This commit is contained in:
parent
7cab972065
commit
9226c0abda
1 changed files with 5 additions and 1 deletions
|
@ -55,11 +55,15 @@ func (s *Session) Connect(req ConnectionRequest) {
|
|||
|
||||
s.updateExpireTimer(req.ConnectPakcet.Properties.SessionExpiryInterval.Value)
|
||||
|
||||
if req.ConnectPakcet.ClientId != nil {
|
||||
if req.ConnectPakcet.ClientId == nil {
|
||||
if s.ClientID == nil {
|
||||
s.ClientID = genClientID()
|
||||
}
|
||||
connAck.Properties.AssignedClientIdentifier.Value = s.ClientID
|
||||
} else if s.ClientID != nil && s.ClientID != req.ConnectPakcet.ClientId {
|
||||
panic(fmt.Errorf("Session %s connect called with a connect packet with an ID: %s", *s.ClientID, *req.ConnectPakcet.ClientId))
|
||||
} else {
|
||||
s.ClientID = req.ConnectPakcet.ClientId
|
||||
}
|
||||
|
||||
true := byte(1)
|
||||
|
|
Loading…
Reference in a new issue