From 4297d035db4ba7799185461833a3b2f6ccd0a69b Mon Sep 17 00:00:00 2001 From: dviejokfs Date: Wed, 15 Feb 2023 23:32:24 +0100 Subject: [PATCH] Sync mutex when cleanup --- cmd/server/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/server/server.go b/cmd/server/server.go index 7c99296..f6516a9 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -44,6 +44,8 @@ type SessionRegistry struct { } func (s *Session) cleanup() { + s.Lock() + defer s.Unlock() defer func() { s.cleanupDone = true }() @@ -341,6 +343,7 @@ func NewServerCmd() *cobra.Command { } type Session struct { + sync.RWMutex cleanupDone bool SNI string `json:"sni"` //RemoteAddr string `json:"remoteAddr"`