Skip to content

Commit 47c1075

Browse files
committed
fix(mqtt):1.10.8, 解决mqtt在tcp连接成功后,进行mqtt握手时断网,不能回调上层的问题
1 parent fcfe889 commit 47c1075

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

modules/mqtt/client.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,19 @@ void Client::handleDisconnectEvent()
706706
disableSocketRead();
707707
disableSocketWrite();
708708

709-
if (d_->state >= State::kTcpConnected) {
710-
if (d_->state == State::kMqttConnected) {
711-
++d_->cb_level;
709+
if (d_->state == State::kTcpConnected ||
710+
d_->state == State::kMqttConnected) {
711+
tryReconnect();
712+
713+
++d_->cb_level;
714+
if (d_->state == State::kTcpConnected) {
715+
if (d_->callbacks.connect_fail)
716+
d_->callbacks.connect_fail();
717+
} else {
712718
if (d_->callbacks.disconnected)
713719
d_->callbacks.disconnected();
714-
--d_->cb_level;
715720
}
716-
717-
tryReconnect();
721+
--d_->cb_level;
718722
}
719723
}
720724

version.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
# TBOX版本号
2222
TBOX_VERSION_MAJOR := 1
2323
TBOX_VERSION_MINOR := 10
24-
TBOX_VERSION_REVISION := 7
24+
TBOX_VERSION_REVISION := 8

0 commit comments

Comments
 (0)