Fake database connection with routine which marks all users as guests, when no database host was specified
authorunc0rr
Mon, 02 Mar 2009 21:23:27 +0000
changeset 1857 b835395659e2
parent 1856 e71dbf958c87
child 1858 a6189dbd16f0
Fake database connection with routine which marks all users as guests, when no database host was specified
gameServer/OfficialServer/DBInteraction.hs
--- a/gameServer/OfficialServer/DBInteraction.hs	Mon Mar 02 21:20:45 2009 +0000
+++ b/gameServer/OfficialServer/DBInteraction.hs	Mon Mar 02 21:23:27 2009 +0000
@@ -16,6 +16,15 @@
 import CoreTypes
 
 
+fakeDbConnection serverInfo = do
+	q <- readChan $ dbQueries serverInfo
+	case q of
+		CheckAccount clID name -> do
+			writeChan (coreChan serverInfo) $ ClientAccountInfo clID Guest
+
+	fakeDbConnection serverInfo
+
+
 -------------------------------------------------------------------
 -- borrowed from base 4.0.0 ---------------------------------------
 onException :: IO a -> IO b -> IO a                              --
@@ -60,4 +69,7 @@
 	dbConnectionLoop serverInfo
 
 startDBConnection serverInfo =
-	when (not . null $ dbHost serverInfo) ((forkIO $ dbConnectionLoop serverInfo) >> return ())
+	if (not . null $ dbHost serverInfo) then
+		forkIO $ dbConnectionLoop serverInfo
+		else
+		forkIO $ fakeDbConnection serverInfo