Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix panic due to send on closed channel
``` 2025-01-23T12:19:46+08:00 |INFO| New session: bf1be06db4b7c04cb951e5cb90e60f3b panic: send on closed channel goroutine 8 [running]: main.(*user).WriteMsg(0xc000342140, 0x1, {0xc000124050, 0x41, 0x50}) /mnt/wsl/work/rttys/user.go:52 +0x8b main.userLoginAck(0x0, {0xf83100, 0xc000342140}) /mnt/wsl/work/rttys/user.go:75 +0xc9 main.(*broker).run(0xc000270c80) /mnt/wsl/work/rttys/broker.go:212 +0xd91 created by main.runRttys in goroutine 1 /mnt/wsl/work/rttys/main.go:86 +0x595 exit status 2 ``` Run this script to reproduce: ``` local websocket = require 'eco.websocket' local ws, err = websocket.connect('ws://127.0.0.1:5913/connect/test') if not ws then print('failed to connect: ' .. err) return end os.exit() ``` Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
- Loading branch information