sebastian-heinz / Arrowgene.DragonsDogmaOnline

Server for Dragons Dogma Online
GNU Affero General Public License v3.0
162 stars 52 forks source link

Connection entries don't get removed on disconnection sometimes #468

Open alborrajo opened 3 weeks ago

alborrajo commented 3 weeks ago

Describe the bug It's been reported that sometimes, when a client gets disconnected (connection dropped as opposed to a regular logout), the entry in the database for that connection doesn't get removed. This means that whenever they try to log in back again, the server will think that they're still online, and kick them out.

To Reproduce Steps to reproduce the behavior:

  1. Get ingame
  2. You'll see an entry in the database table ddon_connection for the connection
  3. Somehow force a disconnect
  4. The entry will still be there when it should've been removed If one were to tr logging back in, they'd be greeted by the error S-6008 (ERROR_CODE_AUTH_MULTIPLE_LOGIN)

Expected behavior The entry for the connection should be removed when the client disconnects

Additional context There's a function in both DdonGameServer and DdonLoginServer that handles cleaning up after a client disconnects. It has code in place for deleting the entry from the database on disconnection:

protected override void ClientDisconnected(GameClient client)
{
    ClientLookup.Remove(client);

    Account account = client.Account;
    if (account != null)
    {
        Database.DeleteConnection(Id, client.Account.Id);
    }

    ...

However, the entry isn't getting removed. This must be either because client.Account is null, or because the ClientDisconnected function isn't always getting called.

alborrajo commented 3 weeks ago

The problem are half-connected sockets, where the client has dropped connection but the server isn't aware of it. Should be fixed by #486

alborrajo commented 1 week ago

While not as often as before it seems that this issue is still happening sometimes