Fixed bug #400 a transient session (clean=true) that tried to lookup session from persistent store

This commit is contained in:
andsel
2018-04-27 12:44:48 +02:00
parent 08949370e6
commit 5456431dd4
5 changed files with 15 additions and 7 deletions
@@ -235,7 +235,7 @@ public class ProtocolProcessor {
}
ConnectionDescriptor descriptor = new ConnectionDescriptor(clientId, channel, cleanSession);
ConnectionDescriptor existing = this.connectionDescriptors.addConnection(descriptor);
final ConnectionDescriptor existing = this.connectionDescriptors.addConnection(descriptor);
if (existing != null) {
LOG.info("Client ID is being used in an existing connection, force to be closed. CId={}", clientId);
existing.abort();
@@ -616,7 +616,8 @@ public class ProtocolProcessor {
if (descriptor.cleanSession) {
LOG.info("Removing saved subscriptions. CId={}", descriptor.clientID);
subscriptionStore.wipeSubscriptions(clientID);
final ClientSession session = this.sessionsRepository.sessionForClient(clientID);
session.wipeSubscriptions();
LOG.info("Saved subscriptions have been removed. CId={}", descriptor.clientID);
}
return true;
@@ -110,11 +110,6 @@ public class SessionsRepository {
return result;
}
private void updateCleanStatus(String clientID, boolean cleanSession) {
LOG.info("Updating cleanSession flag. CId={}, cleanSession={}", clientID, cleanSession);
this.sessions.updateCleanStatus(clientID, cleanSession);
}
ClientSession createOrLoadClientSession(String clientId, boolean cleanSession) {
ClientSession clientSession = this.sessionForClient(clientId);
if (clientSession == null) {