equal
deleted
inserted
replaced
1 {-# LANGUAGE CPP, ScopedTypeVariables, OverloadedStrings #-} |
1 {-# LANGUAGE CPP, ScopedTypeVariables #-} |
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 = forever $ do |
23 fakeDbConnection serverInfo = 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 |
31 |
33 |
32 |
34 |
33 #if defined(OFFICIAL_SERVER) |
35 #if defined(OFFICIAL_SERVER) |
34 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache = |
36 pipeDbConnectionLoop queries coreChan hIn hOut accountsCache = |
35 Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $ |
37 Exception.handle (\(e :: Exception.IOException) -> warningM "Database" (show e) >> return accountsCache) $ |