From 6c5354d17b2a9e104c33353a1b17d0170a662a1a Mon Sep 17 00:00:00 2001 From: imhao183 Date: Wed, 18 Dec 2019 11:37:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96session=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/MemorySessionStore.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java b/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java index 3b94a9ff..158b071c 100755 --- a/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java +++ b/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java @@ -333,20 +333,18 @@ public class MemorySessionStore implements ISessionsStore { Session session = sessions.get(clientID); - if (session == null || !session.username.equals(username)) { - if (session != null && !session.username.equals(username)) { - if (userSessions.get(username) != null) { - userSessions.get(username).remove(clientID); - } + if (session != null && !session.username.equals(username)) { + if (userSessions.get(username) != null) { + userSessions.get(username).remove(clientID); } - ClientSession clientSession = new ClientSession(clientID, this); - session = databaseStore.getSession(username, clientID, clientSession); - - if (session == null) { - session = databaseStore.createSession(username, clientID, clientSession, platform); - } - sessions.put(clientID, session); } + ClientSession clientSession = new ClientSession(clientID, this); + session = databaseStore.getSession(username, clientID, clientSession); + + if (session == null) { + session = databaseStore.createSession(username, clientID, clientSession, platform); + } + sessions.put(clientID, session); if (session.getDeleted() > 0) {