server/shard: added UpdatePlayer(), which should be used whenever player struct state needs to be updated to prevent race conditions

This commit is contained in:
2023-03-26 21:08:13 -05:00
parent bb29a988b3
commit 70e42b5d79
4 changed files with 47 additions and 18 deletions

View File

@@ -120,7 +120,7 @@ func (peer *CNPeer) Handler() {
}
// grab buffer && read packet body
if err := func() error { // we wrap this in a closure so we can easily defer the buffer return to pool
if err := func() error {
buf := pool.Get()
defer pool.Put(buf)
if _, err := buf.ReadFrom(io.LimitReader(peer.conn, int64(sz))); err != nil {