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

大佬们看下这个是什么问题,websocket销毁时链接类型断言错误 #202

Open
zrcshmily opened this issue Mar 1, 2024 · 0 comments

Comments

@zrcshmily
Copy link

zrcshmily commented Mar 1, 2024

2024/01/12 01:40:12 [error ] log.go:191 ^[[1;31minterface conversion: net.Conn is *tls.Conn, not *net.TCPConn: goroutine 181 [running]:
xxx/leaf/log.SysRecover({0x10ae440, 0xc023359170})
xxx/Go/src/runtime/panic.go:884 +0x213
xxx/leaf/network.(*WSConn).doDestroy(0x12cf8c5?)
xxx/leaf/network/ws_conn.go:55 +0x91

go版本1.20.12
销毁链接的时候发现类型错误 使用的是websocket
目前是通过类型判断容错了
leaf/network
/ws_conn.go
func (wsConn *WSConn) doDestroy() {
wsConn.conn.UnderlyingConn().(*net.TCPConn).SetLinger(0)
wsConn.conn.Close()

if !wsConn.closeFlag {
	close(wsConn.writeChan)
	wsConn.closeFlag = true
}

}

image

PS:websocket使用wss

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