【fix】子设备上报方式修复

This commit is contained in:
XM-GO
2023-09-28 10:38:02 +08:00
parent 0dc58c0d18
commit 0b568d16e1
13 changed files with 378 additions and 64 deletions

View File

@@ -6,7 +6,6 @@ import (
"fmt"
"github.com/emicklei/go-restful/v3"
"io"
"log"
"net"
"net/http"
"pandax/iothub/hook_message_work"
@@ -41,11 +40,10 @@ func InitHttpHook(addr string, hs *hook_message_work.HookService) {
// 断开连接
switch state {
case http.StateHijacked, http.StateClosed:
etoken, _ := activeConnections.Load(conn.RemoteAddr())
log.Println("关闭http连接")
etoken, _ := activeConnections.Load(conn.RemoteAddr().String())
data := netbase.CreateConnectionInfo(message.DisConnectMes, "http", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken.(*tool.DeviceAuth))
activeConnections.Delete(conn.RemoteAddr().String())
service.HookService.MessageCh <- data
activeConnections.Delete(conn.RemoteAddr())
}
}
err := server.Start(context.TODO())