fix bug close session of device: sessionMetaData.setOverwriteActivityTime(true);
This commit is contained in:
parent
d5177f5bbf
commit
2a6000d8ce
@ -1060,7 +1060,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSparkplugNodeSession(MqttConnectMessage connectMessage, ChannelHandlerContext ctx) {
|
private void checkSparkplugNodeSession(MqttConnectMessage connectMessage, ChannelHandlerContext ctx, SessionMetaData sessionMetaData) {
|
||||||
try {
|
try {
|
||||||
if (sparkplugSessionHandler == null) {
|
if (sparkplugSessionHandler == null) {
|
||||||
SparkplugTopic sparkplugTopicNode = validatedSparkplugTopicConnectedNode(connectMessage);
|
SparkplugTopic sparkplugTopicNode = validatedSparkplugTopicConnectedNode(connectMessage);
|
||||||
@ -1069,6 +1069,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
|
|||||||
sparkplugSessionHandler = new SparkplugNodeSessionHandler(this, deviceSessionCtx, sessionId, sparkplugTopicNode);
|
sparkplugSessionHandler = new SparkplugNodeSessionHandler(this, deviceSessionCtx, sessionId, sparkplugTopicNode);
|
||||||
sparkplugSessionHandler.onAttributesTelemetryProto(0, sparkplugBProtoNode,
|
sparkplugSessionHandler.onAttributesTelemetryProto(0, sparkplugBProtoNode,
|
||||||
deviceSessionCtx.getDeviceInfo().getDeviceName(), sparkplugTopicNode);
|
deviceSessionCtx.getDeviceInfo().getDeviceName(), sparkplugTopicNode);
|
||||||
|
sessionMetaData.setOverwriteActivityTime(true);
|
||||||
} else {
|
} else {
|
||||||
log.trace("[{}][{}] Failed to fetch sparkplugDevice connect: sparkplugTopicName without SparkplugMessageType.NDEATH.", sessionId, deviceSessionCtx.getDeviceInfo().getDeviceName());
|
log.trace("[{}][{}] Failed to fetch sparkplugDevice connect: sparkplugTopicName without SparkplugMessageType.NDEATH.", sessionId, deviceSessionCtx.getDeviceInfo().getDeviceName());
|
||||||
throw new ThingsboardException("Invalid request body", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
|
throw new ThingsboardException("Invalid request body", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
|
||||||
@ -1145,7 +1146,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
|
|||||||
public void onSuccess(Void msg) {
|
public void onSuccess(Void msg) {
|
||||||
SessionMetaData sessionMetaData = transportService.registerAsyncSession(deviceSessionCtx.getSessionInfo(), MqttTransportHandler.this);
|
SessionMetaData sessionMetaData = transportService.registerAsyncSession(deviceSessionCtx.getSessionInfo(), MqttTransportHandler.this);
|
||||||
if (deviceSessionCtx.isSparkplug()) {
|
if (deviceSessionCtx.isSparkplug()) {
|
||||||
checkSparkplugNodeSession(connectMessage, ctx);
|
checkSparkplugNodeSession(connectMessage, ctx, sessionMetaData);
|
||||||
} else {
|
} else {
|
||||||
checkGatewaySession(sessionMetaData);
|
checkGatewaySession(sessionMetaData);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user