equal
deleted
inserted
replaced
12 import Monad |
12 import Monad |
13 import Maybe |
13 import Maybe |
14 import System.Log.Logger |
14 import System.Log.Logger |
15 ------------------------ |
15 ------------------------ |
16 import CoreTypes |
16 import CoreTypes |
|
17 |
|
18 |
|
19 fakeDbConnection serverInfo = do |
|
20 q <- readChan $ dbQueries serverInfo |
|
21 case q of |
|
22 CheckAccount clID name -> do |
|
23 writeChan (coreChan serverInfo) $ ClientAccountInfo clID Guest |
|
24 |
|
25 fakeDbConnection serverInfo |
17 |
26 |
18 |
27 |
19 ------------------------------------------------------------------- |
28 ------------------------------------------------------------------- |
20 -- borrowed from base 4.0.0 --------------------------------------- |
29 -- borrowed from base 4.0.0 --------------------------------------- |
21 onException :: IO a -> IO b -> IO a -- |
30 onException :: IO a -> IO b -> IO a -- |
58 |
67 |
59 threadDelay (5 * 10^6) |
68 threadDelay (5 * 10^6) |
60 dbConnectionLoop serverInfo |
69 dbConnectionLoop serverInfo |
61 |
70 |
62 startDBConnection serverInfo = |
71 startDBConnection serverInfo = |
63 when (not . null $ dbHost serverInfo) ((forkIO $ dbConnectionLoop serverInfo) >> return ()) |
72 if (not . null $ dbHost serverInfo) then |
|
73 forkIO $ dbConnectionLoop serverInfo |
|
74 else |
|
75 forkIO $ fakeDbConnection serverInfo |