server for my chess game
Diffstat (limited to 'src/index.js')
| -rw-r--r-- | src/index.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/index.js b/src/index.js index a839b0d..73f5896 100644 --- a/src/index.js +++ b/src/index.js @@ -311,13 +311,11 @@ function handle_hostrequest(data, ws) { } function handle_stop(data, ws) { - if (games.hasOwnProperty(data.gamecode)) { - if (games[data.gamecode].clients.includes(ws)) { - console.log("stopgame " + data.gamecode); - games[data.gamecode].send_group_packet(data.reason, HEADERS.stopgame); - delete games[data.gamecode]; // kill - } - } + if ( + games.hasOwnProperty(data.gamecode) && + games[data.gamecode].clients.includes(ws) + ) + delete games[data.gamecode]; // kill } function handle_move(data, ws) { |