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

Fix issue where players added or removed from friend or foe lists did not have games updated #1026

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

benjamin-lawson
Copy link
Contributor

@benjamin-lawson benjamin-lawson commented Sep 6, 2024

Changes

  • Add 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.
  • When social add or remove is called, it will send an updated game list to the target of the social add or remove.

Potential Issues

  • Lots of social adds and removes has the potential for abuse of resources (DDOS). This would really be apparent if there are lots of games as well.
  • The client might not accept the game list updates.

TODO

  • Need to add unit/integration tests around this functionality.

Closes #1002

@Askaholic
Copy link
Collaborator

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!

@benjamin-lawson
Copy link
Contributor Author

benjamin-lawson commented Sep 11, 2024

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.

@Askaholic
Copy link
Collaborator

Askaholic commented Sep 11, 2024

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:

for game in dirty_games:

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newly foed/friended players don't receive necessary game_info messages
2 participants