Closed benjamin-lawson closed 3 weeks ago
Hey thanks for the PR! I added the issue link to the description so it shows up in GitHub nicely.
I think you can avoid much of the DOS concerns by sending only the 1 game_info message that actually would change instead of the entire game list. Since the visibility will only change for the game that the player doing the social add/remove is currently hosting. Hopefully the way I said that makes sense.
Thanks for taking this on! I have so little time for FAF development anymore but more than happy to give reviews and answer any questions you may have about the code!
Hey thanks for the PR! I added the issue link to the description so it shows up in GitHub nicely.
I think you can avoid much of the DOS concerns by sending only the 1 game_info message that actually would change instead of the entire game list. Since the visibility will only change for the game that the player doing the social add/remove is currently hosting. Hopefully the way I said that makes sense.
Okay! So if I send the client a game_info message with just the single game that would be affected by the friend or foe change, the client would update only that single game? I would think it would remove all the other games in that case.
Thanks for taking this on! I have so little time for FAF development anymore but more than happy to give reviews and answer any questions you may have about the code!
No worries at all! Trying to knock out some of the low hanging fruit on the server side to understand the codebase better.
So the way the protocol is designed is that the client only removes a game from the game list when it sees a game_info message with "state": "closed"
. That way we can send updates on a per game basis without having to send the entire game list. The main code that handles this is in the broadcast service: https://github.com/FAForever/server/blob/645d001c08228f8f30f031f30f44a8eca624e9a5/server/broadcast_service.py#L89
You can see there that only the “dirty” (i.e. games that had a state change that hasn’t been sent to the connected clients yet) games are added to the list. Any games that haven’t seen any state changes are ignored.
Hope that helps!
Changes
send_game_list_to_player()
that will send the game's they have access to a specific player rather than just the logged in user.Potential Issues
TODO
Closes #1002