server icon indicating copy to clipboard operation
server copied to clipboard

disconnect peers from player closing the game

Open muellni opened this issue 6 years ago • 5 comments

I'm experiencing two issues in my ice branch:

  • if the host closes his game, the other peers do not get the DisconnectFromPeer message and will get the timeout after a while
  • if a player Alt-F4 quits during the game the other peers also only get a timeout after a while

If the client detects the game process has quit, the server gets noticed. This triggers abort() but abort() will never reach the DisconnectFromPeer code, because the game is not in GameState.LOBBY for these two cases (because the host quitting will trigger on_game_end() before)

I would suggest to inform the other peers here: https://github.com/FAForever/server/blob/develop/server/gameconnection.py#L434

muellni avatar Jun 10 '18 00:06 muellni

I just tested the DisconnectFromPeer message, but it looks it doesn't have the desired effect on the game: the peer is still about to time out. I was hoping for a "host left game" message in the lobby or some "player disconnected, you win" message in the game

muellni avatar Jun 10 '18 00:06 muellni

I also tested EjectPeer but without effect either. I guess you can't disconnect without timing out. But there must be a way using the P2P protocol.

muellni avatar Jun 10 '18 01:06 muellni

if a player Alt-F4 quits during the game the other peers also only get a timeout after a while

There's code in the game Lua to cope with this specific situation (I committed it years ago. Prior to that, it would indeed hang your game for the full timeout until you could boot the ragequitter).

See: https://github.com/Crotalus/fa/blob/master/lua/ui/dialogs/eschandler.lua#L15

ChrisKitching avatar Jun 10 '18 21:06 ChrisKitching

But Alt-F4-ragequitting still hangs everyones game, right? I just tested this.

muellni avatar Jun 11 '18 07:06 muellni

Doing it in the above place has the unfortunate side effect of there being no way to recover temporarily losing the TCP connection to the server -- something which is currently "recoverable" in that the game can go on, but the peers' sent results will not count. We'll want a better measure of "liveness" on the server side rather than just the TCP liveness state.

This would lead to a set timeout before the message is sent anyway, and thus won't really change the hanging-waiting-for-timeout situation.

Sheeo avatar Jul 09 '18 05:07 Sheeo