使用IsConnectionOpen替换IsConnected
这里判断是否连接成功使用IsConnectionOpen()方法更准确,因为在断线重连状态IsConnected()也会返回true,但是当断线状态调用BatchReportSubDevicesProperties()会造成阻塞,且无法恢复
This commit is contained in:
parent
d7642805f2
commit
2cda427fbc
|
@ -149,7 +149,7 @@ func (device *baseIotDevice) DisConnect() {
|
||||||
}
|
}
|
||||||
func (device *baseIotDevice) IsConnected() bool {
|
func (device *baseIotDevice) IsConnected() bool {
|
||||||
if device.Client != nil {
|
if device.Client != nil {
|
||||||
return device.Client.IsConnected()
|
return device.Client.IsConnectionOpen()
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue