Files
archived-rttys/client/client.go
T
Jianhui Zhao 9dfc856b74 fix: Fix potential panic issue
```
2025-04-24T06:59:56Z |INFO| New session: 81ee1ed4d12c3048620fbb2168c08257
2025-04-24T07:00:10Z |INFO| Delete session: 81ee1ed4d12c3048620fbb2168c08257
2025-04-24T07:00:17Z |INFO| New session: 427ce01b7f47a7ee8192cefdfa291c8f
2025-04-24T07:00:57Z |INFO| Delete session: 427ce01b7f47a7ee8192cefdfa291c8f
2025-04-24T07:01:55Z |INFO| New session: ffbfd5c596195c2bd43b8c0b6dc3d135
2025-04-24T07:01:57Z |ERRO| websocket: close sent
panic: send on closed channel

goroutine 33 [running]:
main.(*user).WriteMsg(0xc00037e680, 0x2, {0xc000188d10, 0xc, 0xc})
        /home/runner/work/rttys/rttys/user.go:52 +0x8b
main.(*broker).run(0xc00035a000)
        /home/runner/work/rttys/rttys/broker.go:227 +0xf34
created by main.runRttys in goroutine 1
        /home/runner/work/rttys/rttys/main.go:86 +0x595
```

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-04-25 16:03:56 +08:00

19 lines
298 B
Go

package client
// Client abstract device and user
type Client interface {
WriteMsg(typ int, data []byte)
// For users, return the device ID that the user wants to access
// For devices, return the ID of the device
DeviceID() string
IsDevice() bool
Close()
CloseConn()
Closed() bool
}