- commit
- f105a60b7fb1d334f3b2bddd48129acb9a80f82b
- parent
- e8ea76995257b873aa97d60bd54ee72d331d771c
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-10-08 06:25
add buffer to player.send AFAIU, the writing end to a channel has to wait until the other end as read the message. So if one client has a bad connection, the whole game slows down. A queue on the player.send channel can dampen that effect on spikes.
Diffstat
| M | server.go | 2 | +- |
1 files changed, 1 insertions, 1 deletions
diff --git a/server.go b/server.go
@@ -107,7 +107,7 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
107 107
108 108 player := &Player{
109 109 Game: game,
110 -1 send: make(chan []Message),
-1 110 send: make(chan []Message, 5),
111 111 queue: []Message{},
112 112 conn: conn,
113 113 alive: true,