mirror of
https://github.com/1f349/violet.git
synced 2024-11-23 11:51:37 +00:00
Fix up this lock
This commit is contained in:
parent
1f72795f22
commit
fbbcf0440c
@ -40,16 +40,17 @@ func (s *Server) Upgrade(rw http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.connLock.Lock()
|
s.connLock.Lock()
|
||||||
defer s.connLock.Unlock()
|
|
||||||
|
|
||||||
// no more connections allowed
|
// no more connections allowed
|
||||||
if s.connStop {
|
if s.connStop {
|
||||||
|
s.connLock.Unlock()
|
||||||
_ = c.Close()
|
_ = c.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// save connection for shutdown
|
// save connection for shutdown
|
||||||
s.conns[c.RemoteAddr().String()] = c
|
s.conns[c.RemoteAddr().String()] = c
|
||||||
|
s.connLock.Unlock()
|
||||||
|
|
||||||
log.Printf("[Websocket] Dialing: '%s'\n", req.URL.String())
|
log.Printf("[Websocket] Dialing: '%s'\n", req.URL.String())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user