Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game list sent on login sends all games, not just visible ones #777

Closed
Askaholic opened this issue Apr 20, 2021 · 0 comments · Fixed by #817
Closed

Game list sent on login sends all games, not just visible ones #777

Askaholic opened this issue Apr 20, 2021 · 0 comments · Fixed by #817

Comments

@Askaholic
Copy link
Collaborator

Askaholic commented Apr 20, 2021

Problem

When a player logs in they are sent a list of all open games here:

async def send_game_list(self):
await self.send({
"command": "game_info",
"games": [game.to_dict() for game in self.game_service.open_games]
})

However, there are certain visibility rules that are followed in consequent broadcasted game updates here:

server/server/__init__.py

Lines 174 to 180 in 4dd4c92

self.write_broadcast(
message,
lambda conn: (
conn.authenticated
and game.is_visible_to_player(conn.player)
)
)

This causes 2 problems:

  1. When a player logs in they can see friend only games for people who don't have them as friends, and they can see games of people who have foed them.
  2. They will not receive any updates about those games causing them to appear as "ghost lobbies" that never go away.

Solution

Fixing it should be as simple as adding a filter condition that calls is_visible_to_player to the list comprehension in send_game_list.

Tests

We should add at least the following tests:

  1. A test in tests/integration_tests/test_server.py that verifies that players can't see foes games and can't see games outside of their rating range when logging in.
  2. A test in tests/integration_tests/test_matchmaker.py that verifies that players can still launch matchmaker games against foes.
  3. A test in tests/unit_tests/test_lobbyconnection.py that verifies the behavior of send_game_list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant