From b79d05caf2523a52e3ce088e515dbf0f0c40eb3e Mon Sep 17 00:00:00 2001 From: PandaX <18610165312@163.com> Date: Thu, 12 Oct 2023 19:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=8E=89=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yml | 1 - iothub/server/httpserver/hook.go | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config.yml b/config.yml index b7b84cf..f19e2d0 100644 --- a/config.yml +++ b/config.yml @@ -75,7 +75,6 @@ gen: # 视频服务器使用的全局配置 global: - loglevel: info http: listenaddr: :8801 # 网关地址,用于访问API listenaddrtls: :8443 # 用于HTTPS方式访问API的端口配置 diff --git a/iothub/server/httpserver/hook.go b/iothub/server/httpserver/hook.go index 5b65101..7d1c46d 100644 --- a/iothub/server/httpserver/hook.go +++ b/iothub/server/httpserver/hook.go @@ -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())