From 2cda427fbc680b49f44b9b531a116a67bba3ae64 Mon Sep 17 00:00:00 2001 From: Darkgod <1107763961@qq.com> Date: Thu, 1 Jul 2021 13:58:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8IsConnectionOpen=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2IsConnected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这里判断是否连接成功使用IsConnectionOpen()方法更准确,因为在断线重连状态IsConnected()也会返回true,但是当断线状态调用BatchReportSubDevicesProperties()会造成阻塞,且无法恢复 --- base_device.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_device.go b/base_device.go index 4334b63..bbc66fc 100644 --- a/base_device.go +++ b/base_device.go @@ -149,7 +149,7 @@ func (device *baseIotDevice) DisConnect() { } func (device *baseIotDevice) IsConnected() bool { if device.Client != nil { - return device.Client.IsConnected() + return device.Client.IsConnectionOpen() } return false