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

ipv4/ipv6 localhost and letter count again #108

Open
pkolano opened this issue Sep 9, 2023 · 2 comments
Open

ipv4/ipv6 localhost and letter count again #108

pkolano opened this issue Sep 9, 2023 · 2 comments
Labels
question Further information is requested

Comments

@pkolano
Copy link

pkolano commented Sep 9, 2023

Following up with the localhost item I mentioned, I was able to get it to bind to ipv4 localhost without forcing it to 127.0.0.1 in server.js by changing /etc/gai.conf to prefer ipv4. This can be done using the line (default is 10 so 100 makes ipv6 less preferable):

precedence ::ffff:0:0/96 100

The reason ipv6 wasn't working for me is because I have my web server redirecting 9093 to 127.0.0.1 instead of just "localhost". I didn't test, but likely I could have kept gai.conf as is and alternatively changed the webserver config to redirect to "localhost" instead of 127.0.0.1. So think your code is fine in that regard.

We did still notice some weird behavior of the letter count at the end. It was flipping back and forth from on to off. I'm not positive, but it seemed like it was happening (in our 3 player game at least) when two of the players had less than 7 tiles, but the third had 7. In this case, it happened to be me and it seemed like when I put a couple letters down on the board, that's when the count started disappearing, but then would reapper with a refresh, but then disappear if I hit the take back tiles button and so on. So may be something around the logic of playing tiles and when only one player has 7, although not positive as we only played one game with the new code.

@cdot
Copy link
Owner

cdot commented Sep 13, 2023

Puzzling, The logic that handles the display of tile counts is purely front-end - the server tells each player how many tiles each player has, and the display is updated accordingly. If the server was misinforming the players, I would expect to see the tile counts "go funny" for all players, not just a single player, and it should not be affected by a refresh. Therefore the problem is in the UI code. I will investigate.

@cdot cdot added the question Further information is requested label Oct 16, 2023
@cdot
Copy link
Owner

cdot commented Oct 16, 2023

I have tried everything I can think of, but I can't reproduce this (on 3.1.5). The following is an a posteriori analysis based on the limited information available.

GameUIMixin.updateGameStatus calls GameUIMixin.updateTileCounts, which refreshes the remaining tile counts for each player when the letter bag is empty. The code issues an empty bag warning and iterates over the set of players, updating the tile count for each player by activating the .remaining-tiles CSS class. Tile counts flipping on/off can only happen when the letter bag flips between empty and containing some tiles. This could be confirmed by the The letter bag is empty message also flipping on/off. The swap rack should also appear/disappear. Reporter doesn't mention this, though that doesn't mean it isn't happening.

The letter bag object in question is local to the UI. It should only be modified when a Turn object is received from the server. Since a spurious turn object would indicate a severe flaw in the gameplay, and would be received by all players, I think this is unlikely. So it must be being modified some other way.

Looking back up the call stack, GameUIMixin.updateGameStatus is called when a Turn object is received from the server, but also when the player places or takes back tiles. So something that happens when the player makes one of these moves is affecting the content of the letter bag. As far as I can tell, nothing in the code for placing or taking back tiles seems to touch the letter bag, and would have no reason for doing so.

I'm going to keep this open for now in case anyone can reproduce it consistently; in that case, I hope they can let me have more information as to exactly what happens in the UI.

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

No branches or pull requests

2 participants