From e3dd85d0f52025086b60e7892a71bf53ab7b742a Mon Sep 17 00:00:00 2001 From: bgoulard Date: Wed, 14 Jan 2026 17:14:21 +0100 Subject: [PATCH] fix multiple join on game invite --- src/pong/src/state.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pong/src/state.ts b/src/pong/src/state.ts index 6d0c078..345fd45 100644 --- a/src/pong/src/state.ts +++ b/src/pong/src/state.ts @@ -438,10 +438,14 @@ class StateI { ) { this.fastify.log.warn( 'user trying to connect to a game he\'s not part of: gameId:' + - g_id + - ' userId:' + - sock.authUser.id, - ); + g_id + ' userId:' + sock.authUser.id); + return JoinRes.no; + } + if (game.userOnPage[0] === true && game.userOnPage[1] === true) + { + this.fastify.log.warn( + 'user trying to connect to a game he\'s already joined: gameId:' + + g_id + ' userId:' + sock.authUser.id); return JoinRes.no; } game.userOnPage[game.userLeft === sock.authUser.id ? 0 : 1] = true;