From fbbcf0440c46ee8287e2d2bf6d9e5a02f9ce572d Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Thu, 17 Aug 2023 14:57:41 +0100 Subject: [PATCH] Fix up this lock --- proxy/websocket/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxy/websocket/server.go b/proxy/websocket/server.go index eaea0c0..9a752aa 100644 --- a/proxy/websocket/server.go +++ b/proxy/websocket/server.go @@ -40,16 +40,17 @@ func (s *Server) Upgrade(rw http.ResponseWriter, req *http.Request) { return } s.connLock.Lock() - defer s.connLock.Unlock() // no more connections allowed if s.connStop { + s.connLock.Unlock() _ = c.Close() return } // save connection for shutdown s.conns[c.RemoteAddr().String()] = c + s.connLock.Unlock() log.Printf("[Websocket] Dialing: '%s'\n", req.URL.String())