summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-10-02 16:02:40 +0200
committerPhilipp Sehmisch <crush@themanaworld.org>2009-10-02 16:05:59 +0200
commit9247a35c622bf730449826a1f81226b53c641914 (patch)
treed4b6e07c74d8d8cff70f07082a2ce06a5799c90f /src
parentf5fdb19e7aac292cca31ec23250587e0d97d0ff6 (diff)
downloadmanaserv-9247a35c622bf730449826a1f81226b53c641914.tar.gz
manaserv-9247a35c622bf730449826a1f81226b53c641914.tar.bz2
manaserv-9247a35c622bf730449826a1f81226b53c641914.tar.xz
manaserv-9247a35c622bf730449826a1f81226b53c641914.zip
Game-server now tries again when failing to connect to account-server. Reconnect intervals become longer and longer.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/main-game.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 6a223cd0..ebc92d41 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -298,7 +298,20 @@ int main(int argc, char *argv[])
initialize();
// Make an initial attempt to connect to the account server
- accountHandler->start();
+ // Try again after longer and longer intervals when connection fails.
+ bool isConnected = false;
+ int waittime = 0;
+ while (!isConnected)
+ {
+ LOG_INFO("Connecting to account server");
+ isConnected = accountHandler->start();
+ if (!isConnected)
+ {
+ LOG_INFO("Retrying in "<<++waittime<<" seconds");
+ Sleep(waittime * 1000);
+ }
+
+ }
if (!gameHandler->startListen(options.port))
{
@@ -335,7 +348,7 @@ int main(int argc, char *argv[])
if (accountHandler->isConnected())
{
accountServerLost = false;
-
+
// Handle all messages that are in the message queues
accountHandler->process();