fix: 修复 server.Conn 连接关闭时发生的竞态问题
This commit is contained in:
parent
8fd4e8f722
commit
674c38a066
|
@ -169,6 +169,8 @@ func (slf *Conn) IsClosed() bool {
|
|||
// Close 关闭连接
|
||||
func (slf *Conn) Close(err ...error) {
|
||||
slf.close.Do(func() {
|
||||
slf.mutex.Lock()
|
||||
defer slf.mutex.Unlock()
|
||||
slf.closed = true
|
||||
if slf.ws != nil {
|
||||
_ = slf.ws.Close()
|
||||
|
|
Loading…
Reference in New Issue