gameServer/OfficialServer/DBInteraction.hs
changeset 3425 ead2ed20dfd4
parent 2869 93cc73dcc421
child 3500 af8390d807d6
equal deleted inserted replaced
3424:5543340db663 3425:ead2ed20dfd4
    19 import CoreTypes
    19 import CoreTypes
    20 import Utils
    20 import Utils
    21 
    21 
    22 localAddressList = ["127.0.0.1", "0:0:0:0:0:0:0:1", "0:0:0:0:0:ffff:7f00:1"]
    22 localAddressList = ["127.0.0.1", "0:0:0:0:0:0:0:1", "0:0:0:0:0:ffff:7f00:1"]
    23 
    23 
    24 fakeDbConnection serverInfo = do
    24 fakeDbConnection serverInfo = forever $ do
    25     q <- readChan $ dbQueries serverInfo
    25     q <- readChan $ dbQueries serverInfo
    26     case q of
    26     case q of
    27         CheckAccount clUid _ clHost -> do
    27         CheckAccount clUid _ clHost -> do
    28             writeChan (coreChan serverInfo) $ ClientAccountInfo (clUid,
    28             writeChan (coreChan serverInfo) $ ClientAccountInfo (clUid,
    29                 if clHost `elem` localAddressList then Admin else Guest)
    29                 if clHost `elem` localAddressList then Admin else Guest)
    30         ClearCache -> return ()
    30         ClearCache -> return ()
    31         SendStats {} -> return ()
    31         SendStats {} -> return ()
    32 
       
    33     fakeDbConnection serverInfo
       
    34 
    32 
    35 
    33 
    36 #if defined(OFFICIAL_SERVER)
    34 #if defined(OFFICIAL_SERVER)
    37 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache =
    35 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache =
    38     Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $
    36     Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $