提交 c54fea24 编写于 作者: 如梦技术's avatar 如梦技术 🐛

逻辑优化。

上级 913c7b07
......@@ -469,11 +469,14 @@ public final class MqttClient {
* @return 是否停止成功
*/
public boolean stop() {
// 先断开连接
// 1. 先停止 ack 服务
this.ackService.stop();
// 2. 断开连接
this.disconnect();
// 3. 停止 tio
boolean result = tioClient.stop();
logger.info("MqttClient stop result:{}", result);
this.ackService.stop();
// 4. 清理 session
this.clientSession.clean();
return result;
}
......
......@@ -353,6 +353,9 @@ public final class MqttServer {
* @return 是否停止
*/
public boolean stop() {
// 先停止 ack 服务
this.ackService.stop();
// 再停止服务
boolean result = this.tioServer.stop();
logger.info("Mqtt tcp server stop result:{}", result);
if (webServer != null) {
......@@ -364,7 +367,6 @@ public final class MqttServer {
} catch (Throwable e) {
logger.error("MqttServer stop session clean error.", e);
}
this.ackService.stop();
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册