Marco
ae3e73f711
1. Implement thread-safe ringbuffer for websocket messages This implements a ringbuffer that is used to decouple the raw websocket connection from the messages that the game handler handles. 2. Change websocket handling With this commit, we stop waiting for the websocket connection to be established before the game starts. Now, the Connection type is responsible for waiting for the websocket connection before writing. Some bugs are still happening: 1. The rejoining client is not told the state of the board 2. Invalid moves are not handled by the client (not sure why though) 3. The still-connected client should be told, that the opponent disconnected. Then the client should show the passphrase again 3. Introduce method to send status of board and player 4. Reconnect works (kind of) With the right changes in the client, the reconnect works (but only for the first time). WARNING: At the moment, we will create a new player whenever connection wants to join a private game. This will also clear all the disconnect callbacks that we set in the player.
47 lines
1.8 KiB
Modula-2
47 lines
1.8 KiB
Modula-2
module mchess_server
|
|
|
|
go 1.21.1
|
|
|
|
require (
|
|
github.com/gin-gonic/gin v1.9.1
|
|
github.com/google/uuid v1.4.0
|
|
github.com/samber/lo v1.38.1
|
|
github.com/stretchr/testify v1.8.4
|
|
github.com/tjarratt/babble v0.0.0-20210505082055-cbca2a4833c1
|
|
nhooyr.io/websocket v1.8.10
|
|
)
|
|
|
|
require (
|
|
github.com/bytedance/sonic v1.10.2 // indirect
|
|
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
|
github.com/chenzhuoyu/iasm v0.9.1 // indirect
|
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
|
github.com/go-playground/locales v0.14.1 // indirect
|
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
|
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
|
github.com/goccy/go-json v0.10.2 // indirect
|
|
github.com/google/go-cmp v0.5.9 // indirect
|
|
github.com/json-iterator/go v1.1.12 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
|
|
github.com/leodido/go-urn v1.2.4 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
github.com/onsi/ginkgo v1.16.5 // indirect
|
|
github.com/onsi/gomega v1.27.10 // indirect
|
|
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
|
github.com/ugorji/go/codec v1.2.11 // indirect
|
|
golang.org/x/arch v0.6.0 // indirect
|
|
golang.org/x/crypto v0.15.0 // indirect
|
|
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
|
golang.org/x/net v0.18.0 // indirect
|
|
golang.org/x/sys v0.14.0 // indirect
|
|
golang.org/x/text v0.14.0 // indirect
|
|
google.golang.org/protobuf v1.31.0 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|