Do not exit on unrecognized event

This commit is contained in:
Trevor Slocum 2024-11-20 14:27:08 -08:00
parent 2648772e51
commit b604077988
3 changed files with 8 additions and 10 deletions

View file

@ -173,8 +173,7 @@ func (c *Client) handleWebSocketRead(conn *websocket.Conn) {
ev, err := bgammon.DecodeEvent(msg)
if err != nil {
log.Printf("error: failed to parse message: %s", msg)
conn.Close(websocket.StatusNormalClosure, "Read error")
return
continue
}
c.Events <- ev
@ -280,8 +279,7 @@ func (c *Client) handleTCPRead(conn net.Conn) {
ev, err := bgammon.DecodeEvent(scanner.Bytes())
if err != nil {
log.Printf("error: failed to parse message: %s", scanner.Bytes())
conn.Close()
return
continue
}
c.Events <- ev

4
go.mod
View file

@ -6,8 +6,8 @@ toolchain go1.23.0
require (
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240916195023-c833adb3566e
code.rocket9labs.com/tslocum/bgammon v0.0.0-20241120221233-00e4e4da52c2
github.com/coder/websocket v1.8.12
)
require code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be // indirect
require code.rocket9labs.com/tslocum/tabula v0.0.0-20241024013344-d112a9463c51 // indirect

8
go.sum
View file

@ -1,8 +1,8 @@
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b h1:Y0a14Kf/hSYepSmp4ZfDeE4CZZGBGBS97CNjCbKJm0c=
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b/go.mod h1:tS60/VNAJphKvDBkSLQhKALa15msIAuWWfEKNc4oFZc=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240916195023-c833adb3566e h1:OnSJcIiARnkoBYsPAjV+wUVqZ5u7POvHFrGtTg4REVw=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240916195023-c833adb3566e/go.mod h1:fW6aZ6va+Wh8Hw/r7fkIAHUmo/Mwkm0kR2llEX2G3Uc=
code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be h1:awgpl3vS+d7vciw7X5z+joGSPZHB1OOTpkPKW3mPGDs=
code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be/go.mod h1:WEJXESKXqrMFLAArikQ79lpRibNeeE1C0VruxXYMF5M=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20241120221233-00e4e4da52c2 h1:sRRgE5J+OsvLgHgJeO4pI2yraGO+6VwdfoXF4Zc+fA0=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20241120221233-00e4e4da52c2/go.mod h1:FzdCJoZoG/6nkxLl6OufdfFTXggr5ZArtl7eJ/CCcj0=
code.rocket9labs.com/tslocum/tabula v0.0.0-20241024013344-d112a9463c51 h1:JkjRKoSSmtHFSVIOAZV6e+Z+7r0mIxClsDpJxC/ZlOs=
code.rocket9labs.com/tslocum/tabula v0.0.0-20241024013344-d112a9463c51/go.mod h1:WEJXESKXqrMFLAArikQ79lpRibNeeE1C0VruxXYMF5M=
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=