Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG问题 write tcp xxx.xx.xxx.xxx:36532->xxx.xx.xxx.x:443: write: broken pipe #1

Closed
iszmxw opened this issue Mar 19, 2022 · 1 comment

Comments

@iszmxw
Copy link

iszmxw commented Mar 19, 2022

image
经常出现这个问题,我跑在本地虚拟机没有看到过,但是在阿里云服务器上就会遇到这个

@iszmxw
Copy link
Author

iszmxw commented Mar 20, 2022

image
image
image

这段代码是不是关闭的有问题

func (ws *WebSocketOp) Close() {
	ws.conn.Close()
	ws.mutex.Lock()
	defer ws.mutex.Unlock()
	if !ws.isClose {
		ws.isClose = true
		ws.authOk = false
		close(ws.closeChan)
	}
	ws.closeChanCallback <- struct{}{}
}

这样会好点吗

func (ws *WebSocketOp) Close() {
	ws.mutex.Lock()
	ws.conn.Close()
	defer ws.mutex.Unlock()
	if !ws.isClose {
		ws.isClose = true
		ws.authOk = false
		close(ws.closeChan)
	}
	ws.closeChanCallback <- struct{}{}
}

@iszmxw iszmxw closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant