2
0

make Close more atomic

This commit is contained in:
Nikolay Pavlovich
2022-08-12 01:57:40 +03:00
parent a25330e8f2
commit dd31a10749
+4 -5
View File
@@ -82,13 +82,12 @@ func (rc *RecConn) getConn() *websocket.Conn {
// Close closes the underlying network connection without
// sending or waiting for a close frame.
func (rc *RecConn) Close() {
if rc.getConn() != nil {
rc.mu.Lock()
rc.mu.Lock()
if rc.Conn != nil {
rc.Conn.Close()
rc.mu.Unlock()
}
rc.setIsConnected(false)
rc.isConnected = false
rc.mu.Unlock()
}
// Shutdown gracefully closes the connection by sending the websocket.CloseMessage.