gameServer/OfficialServer/DBInteraction.hs
changeset 4906 22cc9c2b5ae5
parent 4568 f85243bf890e
child 4918 c6d3aec73f93
equal deleted inserted replaced
4905:7842d085acf4 4906:22cc9c2b5ae5
     1 {-# LANGUAGE CPP, ScopedTypeVariables #-}
     1 {-# LANGUAGE CPP, ScopedTypeVariables, OverloadedStrings #-}
     2 module OfficialServer.DBInteraction
     2 module OfficialServer.DBInteraction
     3 (
     3 (
     4     startDBConnection
     4     startDBConnection
     5 ) where
     5 ) where
     6 
     6 
    18 import CoreTypes
    18 import CoreTypes
    19 import Utils
    19 import Utils
    20 
    20 
    21 localAddressList = ["127.0.0.1", "0:0:0:0:0:0:0:1", "0:0:0:0:0:ffff:7f00:1"]
    21 localAddressList = ["127.0.0.1", "0:0:0:0:0:0:0:1", "0:0:0:0:0:ffff:7f00:1"]
    22 
    22 
    23 fakeDbConnection serverInfo = do
    23 fakeDbConnection serverInfo = forever $ do
    24     q <- readChan $ dbQueries serverInfo
    24     q <- readChan $ dbQueries serverInfo
    25     case q of
    25     case q of
    26         CheckAccount clUid _ clHost -> do
    26         CheckAccount clUid _ clHost -> do
    27             writeChan (coreChan serverInfo) $ ClientAccountInfo (clUid,
    27             writeChan (coreChan serverInfo) $ ClientAccountInfo (clUid,
    28                 if clHost `elem` localAddressList then Admin else Guest)
    28                 if clHost `elem` localAddressList then Admin else Guest)
    29         ClearCache -> return ()
    29         ClearCache -> return ()
    30         SendStats {} -> return ()
    30         SendStats {} -> return ()
    31 
       
    32     fakeDbConnection serverInfo
       
    33 
    31 
    34 
    32 
    35 #if defined(OFFICIAL_SERVER)
    33 #if defined(OFFICIAL_SERVER)
    36 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache =
    34 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache =
    37     Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $
    35     Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $