summaryrefslogtreecommitdiff
path: root/src/account-server/serverhandler.cpp
diff options
context:
space:
mode:
authorAndreas Habel <mail@exceptionfault.de>2008-11-05 11:40:43 +0000
committerAndreas Habel <mail@exceptionfault.de>2008-11-05 11:40:43 +0000
commit94bf187c196769b87fbbfa9a9c083f94def82ccf (patch)
treecd18513307b2b230ae73e177f6286d40e6e52f3d /src/account-server/serverhandler.cpp
parentbdf512bbe314e301b55ed52b1628415fa55cebe5 (diff)
downloadmanaserv-94bf187c196769b87fbbfa9a9c083f94def82ccf.tar.gz
manaserv-94bf187c196769b87fbbfa9a9c083f94def82ccf.tar.bz2
manaserv-94bf187c196769b87fbbfa9a9c083f94def82ccf.tar.xz
manaserv-94bf187c196769b87fbbfa9a9c083f94def82ccf.zip
Added version information to item database. Gameserver reports its local version to account server during registration and gets notified if the version is up-to-date or outdated to prevent inconsistencies.
Diffstat (limited to 'src/account-server/serverhandler.cpp')
-rw-r--r--src/account-server/serverhandler.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 2e472b81..4bbe4cc4 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -177,6 +177,26 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
// TODO: check the credentials of the game server
server->address = msg.readString();
server->port = msg.readShort();
+
+ // checks the version of the remote item database with our local copy
+ unsigned int dbversion = msg.readLong();
+ LOG_INFO("Game server uses itemsdatabase with version " << dbversion);
+
+ LOG_DEBUG("AGMSG_REGISTER_RESPONSE");
+ MessageOut outMsg(AGMSG_REGISTER_RESPONSE);
+ if (dbversion == storage->getItemDatabaseVersion())
+ {
+ LOG_DEBUG("Item databases between account server and "
+ "gameserver are in sync");
+ outMsg.writeShort(DATA_VERSION_OK);
+ }
+ else
+ {
+ LOG_DEBUG("Item database of game server has a wrong version");
+ outMsg.writeShort(DATA_VERSION_OUTDATED);
+ }
+ comp->send(outMsg);
+
LOG_INFO("Game server " << server->address << ':' << server->port
<< " wants to register " << (msg.getUnreadLength() / 2)
<< " maps.");