saas-smartAi通信协议标准库
gongshangguo
2022-03-01 a7b154fc0a4903270cbef934a5f0f3f675ef1891

1个文件已修改
1个文件已添加
34 ■■■■ 已修改文件
.idea/inspectionProfiles/Project_Default.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
client/client.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/inspectionProfiles/Project_Default.xml
New file
@@ -0,0 +1,26 @@
<component name="InspectionProjectProfileManager">
  <profile version="1.0">
    <option name="myName" value="Project Default" />
    <inspection_tool class="GoUnhandledErrorResult" enabled="true" level="WARNING" enabled_by_default="true">
      <methods>
        <method importPath="hash" receiver="Hash" name="Write" />
        <method importPath="strings" receiver="*Builder" name="Write" />
        <method importPath="strings" receiver="*Builder" name="WriteByte" />
        <method importPath="bytes" receiver="*Buffer" name="WriteRune" />
        <method importPath="bytes" receiver="*Buffer" name="Write" />
        <method importPath="bytes" receiver="*Buffer" name="WriteString" />
        <method importPath="strings" receiver="*Builder" name="WriteString" />
        <method importPath="bytes" receiver="*Buffer" name="WriteByte" />
        <method importPath="strings" receiver="*Builder" name="WriteRune" />
        <method importPath="math/rand" receiver="*Rand" name="Read" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="*Client" name="WriteMsg" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnHeartBeat" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnRegister" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnDeviceControl" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnDataReport" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnRequest" />
        <method importPath="basic.com/valib/go-aiot.git/client" receiver="ClientCallBack" name="OnResponse" />
      </methods>
    </inspection_tool>
  </profile>
</component>
client/client.go
@@ -22,8 +22,6 @@
    DefaultHeartbeatInterval = 15 * time.Second
    // 读取数据超时时间
    DefaultReaderTimeOut = 60 * time.Second
    // 连接尝试间隔
    DefaultNetRetry = 10 * time.Second
)
// 连接状态
@@ -37,8 +35,6 @@
    // 已断开
    StateDisconnected
)
var syncReq map[string]chan *aiot.Protocol
// 连接状态
type State int32
@@ -233,7 +229,7 @@
    }
    // 发送消息
    c.WriteBody(body)
    _ = c.WriteBody(body)
    return body, nil
}
@@ -457,7 +453,7 @@
    defer c.closeLock.Unlock()
    // 关闭通道
    if !c.IsClosed() {
        c.Conn.Close()
        _ = c.Conn.Close()
        if c.IsConnected() {
            c.clientCallback.OnClose(c)
        }