【fix】应用异常掉线

This commit is contained in:
PandaX
2023-10-12 19:12:59 +08:00
parent 656de9414f
commit b79d05caf2
2 changed files with 5 additions and 4 deletions

View File

@@ -75,7 +75,6 @@ gen:
# 视频服务器使用的全局配置
global:
loglevel: info
http:
listenaddr: :8801 # 网关地址用于访问API
listenaddrtls: :8443 # 用于HTTPS方式访问API的端口配置

View File

@@ -41,9 +41,11 @@ func InitHttpHook(addr string, hs *hook_message_work.HookService) {
switch state {
case http.StateHijacked, http.StateClosed:
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
if etoken != nil {
data := netbase.CreateConnectionInfo(message.DisConnectMes, "http", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken.(*tool.DeviceAuth))
activeConnections.Delete(conn.RemoteAddr().String())
service.HookService.MessageCh <- data
}
}
}
err := server.Start(context.TODO())