effective keep-alive?

Started by
12 comments, last by hplus0603 13 years, 9 months ago
Quote:Original post by @
consider MMORPG. lobby (central) server keeps all client connections mainly to prevent logging in the same account.

Of flip a flag in the database. There's no need for there to be one single server that holds every single connection. Checking for duplicate logins isn't a time-critical activity that can't afford a DB access. And you probably have to hit the DB to look up authentication/authorisation stuff anyway.
Advertisement
Quote:Original post by Kylotan
Quote:Original post by @
consider MMORPG. lobby (central) server keeps all client connections mainly to prevent logging in the same account.

Of flip a flag in the database. There's no need for there to be one single server that holds every single connection. Checking for duplicate logins isn't a time-critical activity that can't afford a DB access. And you probably have to hit the DB to look up authentication/authorisation stuff anyway.


looks like error-prone approach:
client authorizes in lobby, lobby marks it as online in db and redirects it to zone server, client disconnects from lobby and crashes but is still marked as online one. the same happens when client moves between zones

to prevent this a sophisticated check if client is really online is required, e.g. to check all zones if this client is really alive

alternatively, to move a client ticket to zone server on redirection so it waits for this client and marks it offline in db when client haven't connected after some time. doesn't look robust too, timeouts are always a pain

Quote:Original post by @
Quote:Original post by Kylotan
Quote:Original post by @
consider MMORPG. lobby (central) server keeps all client connections mainly to prevent logging in the same account.

Of flip a flag in the database. There's no need for there to be one single server that holds every single connection. Checking for duplicate logins isn't a time-critical activity that can't afford a DB access. And you probably have to hit the DB to look up authentication/authorisation stuff anyway.


looks like error-prone approach:
client authorizes in lobby, lobby marks it as online in db and redirects it to zone server, client disconnects from lobby and crashes but is still marked as online one. the same happens when client moves between zones

You'd still have a keepalive system, which would clear the flag in the db when it detects that the connection has been dropped. The difference is that you're not doing it all on one server, nor having to hold an extra connection open just for this purpose.

You might need a small bit of extra code to detect the situation when someone is authorised to log in but doesn't actually do so. But that's usually easily done - give out the login token, then check with the database or zone server after a short time to check that they got through. If not, clear the flag.

Quote:to prevent this a sophisticated check if client is really online is required, e.g. to check all zones if this client is really alive

Easier to have the zones tell the database which clients they have connected.
The online database only needs to forward clients to the right zone server.
The zone server can reject duplicate connections from the same client.
A zone server can also verify that you're supposed to be in that zone when the user connects.
Moving between zones can be as simple as:
1) telling central server what your new zone should be
2) then disconnecting you (to avoid a race)
The client, when disconnected, will just re-connect, which means that it will go to the central server and find out where it's supposed to go.
Simple, and robust.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement