Move websocket connection close out of channel close mutex

pull/530/head
Martin Boehm 2020-11-16 00:14:22 +01:00
parent 579b42cf27
commit 24a783be50
1 changed files with 1 additions and 1 deletions

View File

@ -144,6 +144,7 @@ func (s *WebsocketServer) GetHandler() http.Handler {
func (s *WebsocketServer) closeChannel(c *websocketChannel) {
if c.CloseOut() {
c.conn.Close()
s.onDisconnect(c)
}
}
@ -152,7 +153,6 @@ func (c *websocketChannel) CloseOut() bool {
c.aliveLock.Lock()
defer c.aliveLock.Unlock()
if c.alive {
c.conn.Close()
c.alive = false
//clean out
close(c.out)