We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
服务端时不时崩溃重启,后面贴上两个报错信息
goroutine 49 [running]: main.(*device).WriteMsg(0xc0016e23f0, 0x0, {0xc0027b1e40, 0x3, 0xb?}) /home/runner/work/rttys/rttys/device.go:130 +0xff main.(*broker).run(0xc000694000) /home/runner/work/rttys/rttys/broker.go:97 +0x755 created by main.runRttys /home/runner/work/rttys/rttys/main.go:72 +0x869 panic: send on closed channel goroutine 14 [running]: main.(*device).WriteMsg(0xc000b8a6c0, 0x0, {0xc000b59bf0, 0x3, 0x2?}) /home/runner/work/rttys/rttys/device.go:130 +0xff main.(*broker).run(0xc0003fb040) /home/runner/work/rttys/rttys/broker.go:97 +0x755 created by main.runRttys /home/runner/work/rttys/rttys/main.go:72 +0x869 panic: send on closed channel
The text was updated successfully, but these errors were encountered:
通过加了一些打印信息,发现这个问题是 device.go 的 func (dev *device) WriteMsg(typ int, data []byte) { 函数调用 dev.send <- append(b, data...) 的时候,dev.send 这个通道已经被关闭了,我在这个函数调用的地方加了一个判断规避这个问题,在调用通道前,先判断这个连接是不是已经断开了,但是我不确定这个解决办法是不是完美没有其他影响:
func (dev *device) WriteMsg(typ int, data []byte) { if atomic.LoadUint32(&dev.closed) == 1 { return } ......
Sorry, something went wrong.
是在传输文件的时候崩溃的吗?
应该不是传输文件的时候崩溃,没有做传文件这样的操作
No branches or pull requests
Environment
rtty
rttys
Description
服务端时不时崩溃重启,后面贴上两个报错信息
The text was updated successfully, but these errors were encountered: