Trouble reconnecting after network disconnect
I use the wifi from my smartphone, sometimes the usb cable plugs off and i lose connection, i put it back but even if i have internet connection it has trouble reconnecting.
I have to close the game, sometimes several times before i can log back in.
Steps to reproduce:
Use wifi from external source (maybe works with ethernet cable) Plug off cable when in a game Put cable back and try to login It doesn't log back in the game and shows a red message of failed login
And you've confirmed that your network is indeed fully back up before you try to reconnect?
Can you ping "bigserver2.onehouronelife.com" from a command terminal?
I pinged server from a website and the ping is received correctly
But i still get login failed, i have to click login multiple times until it logs me back in
So the client takes a lot more time to respond when connection is back on, compared to pinging the server from an external tool.
Maybe it's related to the high ping some people get when packets are lost and the client seems to have a hard time "catching up".
Yes, was able to reproduce just now by pulling my own plug.
Server-side, I'm seeing this:
Another client already connected as [email protected], client rejected.
Server is rejecting re-connection. This is because it hasn't seen you as actually disconnected yet. When you pull the plug, the network drops without actually closing, and the server will assume your connection is open (but quiet) for a while. This is the way TCP works. Actually, I think the server will finally see you as disconnected once enough outbound messages pile up so that sending one fails.
In terms of how to deal with this.... even if the server watched for a client's KA message, it still would wait some (long) number of seconds before force-disconnecting you. It wants to avoid doing that at all costs.
Now, we could allow the client to reconnect and "take over" the old connection. There is authentication here, so we're pretty sure that it's "you" and not an imposter. Unless you're sharing your account with a friend, in which case they can take over your current game right out from under you (that's a pretty rare case, though, so I think it's fine to allow that).
Good news! It's fixed. Thanks for giving me the extra info here.
(And if two people are trying to connect with the same credentials, it very cleanly disconnects the first one when the second one connects and takes over.)