From 1a3890f4535e7eb649cf59cbcf1012ab2e03fdf4 Mon Sep 17 00:00:00 2001 From: xugo Date: Wed, 29 May 2024 15:35:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hook/hookmanager.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hook/hookmanager.go b/hook/hookmanager.go index ac570d7..6ccdf4c 100644 --- a/hook/hookmanager.go +++ b/hook/hookmanager.go @@ -10,8 +10,10 @@ type HookSessionMangaer struct { sessionMap sync.Map } -var manager *HookSessionMangaer -var once sync.Once +var ( + manager *HookSessionMangaer + once sync.Once +) func GetHookSessionManagerInstance() *HookSessionMangaer { once.Do(func() { @@ -28,10 +30,10 @@ func (m *HookSessionMangaer) SetHookSession(streamName string, session *HookSess func (m *HookSessionMangaer) RemoveHookSession(streamName string) { nazalog.Info("RemoveHookSession, streamName:", streamName) - s, ok := m.sessionMap.Load(streamName) - if ok { - m.sessionMap.Delete(s) - } + // s, ok := m.sessionMap.Load(streamName) + // if ok { + m.sessionMap.Delete(streamName) + // } } func (m *HookSessionMangaer) GetHookSession(streamName string) (bool, *HookSession) {