Fix up this lock

This commit is contained in:
Melon 2023-08-17 14:57:41 +01:00
parent 1f72795f22
commit fbbcf0440c
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -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())