From 7cd412d08d9f8aea8906980f2574aa26cb8e8918 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Fri, 7 May 2021 11:29:46 -0600 Subject: [PATCH] Don't need to store domain in mqttJSA structure At the time where we need the domain to construct the session hash, we have access to server options. So use that instead of storing the domain in the internal mqtt structure. Signed-off-by: Ivan Kozlovic --- server/mqtt.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/mqtt.go b/server/mqtt.go index 676e34d7..5ed0a72e 100644 --- a/server/mqtt.go +++ b/server/mqtt.go @@ -228,7 +228,6 @@ type mqttJSA struct { replies sync.Map nuid *nuid.NUID quitCh chan struct{} - domain string } type mqttJSPubMsg struct { @@ -890,7 +889,6 @@ func (s *Server) mqttCreateAccountSessionManager(acc *Account, quitCh chan struc sendq: make(chan *mqttJSPubMsg, 8192), nuid: nuid.New(), quitCh: quitCh, - domain: s.getOpts().JetStreamDomain, }, } @@ -1867,7 +1865,7 @@ func (as *mqttAccountSessionManager) createOrRestoreSession(clientID string, opt // with the same client ID moves to the other domain, then there won't be // conflict of session message in one domain updating the session's stream // in others. - hash := string(getHash(as.jsa.domain + clientID)) + hash := string(getHash(opts.JetStreamDomain + clientID)) sname := mqttSessionsStreamNamePrefix + hash cfg := &StreamConfig{ Name: sname,