jappe999 / project-cards

Cards Against Humanity App
https://project-against-cards.herokuapp.com/
GNU General Public License v3.0
1 stars 0 forks source link

Players are not removed from games when their session has expired #31

Closed jappe999 closed 5 years ago

jappe999 commented 5 years ago

When I forcefully shutdown my PC or my session has expired while I'm in game I'm not removed from the player list. This causes the flow of the game to be disturbed.

Expected Behavior

When I forcefully shutdown my PC or my session is expired, I should be removed from the game I'm currently in.

Current Behavior

When the server does not detect that a player has left a game, the flow of the game will be disturbed. For example: If a player that has exited a game and it is assigned the role of Card Czar, the game cannot continue, because no combination is chosen.

Possible Solution

Each time the socket server is called a check for active connections can be done. This can be done by syncing the active connections with the database.

Steps to Reproduce (for bugs)

  1. Join a game in 2 different sessions
  2. Let one of the two sessions expire and exit the game
  3. The other session is still thinking there is another session player in the game

Context

Other players cannot continue playing the game when Card Czar it's session has expired.

Your Environment

jappe999 commented 5 years ago

Maybe some sort of player removal function? That other players (or only the Czar) can remove the player in question.

jappe999 commented 5 years ago

I've discovered that players are removed from the game. Even when their session has expired.

The error occurs when the Czar is disconnected and no other players are in that game. The server cannot select a new Czar and the game is left with a Czar that does not exist.

The issue can be resolved by setting the CurrentCzarId value to null in the database.