Skip to content

Commit

Permalink
优化session处理
Browse files Browse the repository at this point in the history
  • Loading branch information
imhao183 committed Dec 18, 2019
1 parent c98bd1f commit 6c5354d
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,18 @@ public Session updateOrCreateUserSession(String username, String clientID, int p

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);
}
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 == null) {
session = databaseStore.createSession(username, clientID, clientSession, platform);
}
sessions.put(clientID, session);


if (session.getDeleted() > 0) {
Expand Down

0 comments on commit 6c5354d

Please sign in to comment.