Browse Source
MQTT: fix unsubscribe error without previous subscribe (#12575)
improved formatting and moved check to recordActivityInternal.
Added warn log and check on provision
Updated license format
pull/12631/head
artem-barysh-dev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
2 deletions
-
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
-
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java
|
|
@ -963,7 +963,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement |
|
|
unSubResults.add((short) MqttReasonCodes.UnsubAck.NO_SUBSCRIPTION_EXISTED.byteValue()); |
|
|
unSubResults.add((short) MqttReasonCodes.UnsubAck.NO_SUBSCRIPTION_EXISTED.byteValue()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!activityReported) { |
|
|
if (!activityReported && !deviceSessionCtx.isProvisionOnly()) { |
|
|
transportService.recordActivity(deviceSessionCtx.getSessionInfo()); |
|
|
transportService.recordActivity(deviceSessionCtx.getSessionInfo()); |
|
|
} |
|
|
} |
|
|
ctx.writeAndFlush(createUnSubAckMessage(mqttMsg.variableHeader().messageId(), unSubResults)); |
|
|
ctx.writeAndFlush(createUnSubAckMessage(mqttMsg.variableHeader().messageId(), unSubResults)); |
|
|
|
|
|
@ -736,7 +736,11 @@ public class DefaultTransportService extends TransportActivityManager implements |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void recordActivityInternal(TransportProtos.SessionInfoProto sessionInfo) { |
|
|
private void recordActivityInternal(TransportProtos.SessionInfoProto sessionInfo) { |
|
|
onActivity(toSessionId(sessionInfo), sessionInfo, getCurrentTimeMillis()); |
|
|
if (sessionInfo != null) { |
|
|
|
|
|
onActivity(toSessionId(sessionInfo), sessionInfo, getCurrentTimeMillis()); |
|
|
|
|
|
} else { |
|
|
|
|
|
log.warn("Session info is missing, unable to record activity"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|