ACE icon indicating copy to clipboard operation
ACE copied to clipboard

[TEST] network relogin

Open gmriggs opened this issue 4 years ago • 2 comments

Repro steps:

  • In your Config.js, set DefaultSessionTimeout to 999 for easier testing
  • In your log4net.config, set the Console threshold to DEBUG for easier testing
  • Connect to your local server in ThwargLauncher advanced mode. Make sure your server name in ThwargLauncher does NOT match up with your local server name, so that if ThwargLauncher is left open, it automatically disconnects you in ~30s
  • Log into the game world
  • Wait for ThwargLauncher to automatically close the AC window
  • Try to reconnect

Expected:

  • Existing character is booted out of the game world

Actual:

  • Existing character is never booted out of the game world. New session cannot connect.

There are some odd issues with this PR, namely if you try this multiple times, the existing Player state will get into an odd loop, where the Session is disconnected, but the Player is still saving on the landblock or something..

This can be seen after multiple retries, or using /pktimer sometimes helps. The previous session will go into 'SessionTerminating' state, and then be dropped, while the previous player still seems to be in the world. This allows the new session to connect to the char select screen, but then gets into an automatic loop when trying to log into the world, until the existing player is finally logged out.

Could use @fartwhif 's help on this one

gmriggs avatar Mar 12 '20 00:03 gmriggs

Update:

With https://github.com/ACEmulator/ACE/pull/2809/commits/71c27feee83562330b667028ef1d16d0035cf405 , I am still able to repro the 'client repeatedly tries to log into world very rapidly' bug using a new set of repro steps:

  • Start server
  • Log into server via thwarg launcher. Close thwarg launcher window so that it doesn't automatically close the ac window
  • Open thwarg launcher again
  • Set /pktimer on char still logged into world
  • Log in again with thwarg launcher, WITHOUT closing the original acclient window

At this point, since ThwargLauncher will be connecting on a new port, it will get a new session, instead of the existing one. So the new session won't be in 'WorldConnected' state, so it won't hit any of that logic

It will however, hit this logic in AuthenticationHandler, on line 176:

                if (PropertyManager.GetBool("account_login_boots_in_use").Item)
                {
                    var previouslyConnectedAccount = NetworkManager.Find(account.AccountName);

                    if (previouslyConnectedAccount != null)
                    {
                        previouslyConnectedAccount.Terminate(SessionTerminationReason.AccountLoggedIn, new GameMessageCharacterError(CharacterError.Logon));
                    }
                }

Thinking maybe this logic should be moved to NetworkManager.LoginRequest perhaps?

gmriggs avatar Mar 14 '20 10:03 gmriggs

With the revised implementation in https://github.com/ACEmulator/ACE/pull/2809/commits/593cc5f06a1e63a9062e6f256b3234d8da01b146, the previous bug is fixed

gmriggs avatar Mar 14 '20 11:03 gmriggs