Revision db0d2ee9 src/Ganeti/WConfd/Server.hs
b/src/Ganeti/WConfd/Server.hs | ||
---|---|---|
10 | 10 |
|
11 | 11 |
{- |
12 | 12 |
|
13 |
Copyright (C) 2013 Google Inc. |
|
13 |
Copyright (C) 2013, 2014 Google Inc.
|
|
14 | 14 |
|
15 | 15 |
This program is free software; you can redistribute it and/or modify |
16 | 16 |
it under the terms of the GNU General Public License as published by |
... | ... | |
31 | 31 |
|
32 | 32 |
module Ganeti.WConfd.Server where |
33 | 33 |
|
34 |
import Control.Concurrent (forkIO) |
|
34 | 35 |
import Control.Exception |
35 | 36 |
import Control.Monad |
36 | 37 |
import Control.Monad.Error |
... | ... | |
38 | 39 |
|
39 | 40 |
import Ganeti.BasicTypes |
40 | 41 |
import Ganeti.Daemon |
41 |
import Ganeti.Logging (logInfo) |
|
42 |
import Ganeti.Logging (logInfo, logDebug)
|
|
42 | 43 |
import Ganeti.Locking.Allocation |
43 | 44 |
import Ganeti.Locking.Locks |
44 | 45 |
import qualified Ganeti.Path as Path |
... | ... | |
49 | 50 |
import Ganeti.WConfd.ConfigState |
50 | 51 |
import Ganeti.WConfd.ConfigWriter |
51 | 52 |
import Ganeti.WConfd.Core |
53 |
import Ganeti.WConfd.DeathDetection (cleanupLocksTask) |
|
52 | 54 |
import Ganeti.WConfd.Monad |
53 | 55 |
|
54 | 56 |
handler :: DaemonHandle -> RpcServer WConfdMonadInt |
... | ... | |
96 | 98 |
|
97 | 99 |
-- | Main function. |
98 | 100 |
main :: MainFn () PrepResult |
99 |
main _ _ (server, dh) = |
|
101 |
main _ _ (server, dh) = do |
|
102 |
logDebug "Starting the cleanup task" |
|
103 |
_ <- forkIO $ runWConfdMonadInt cleanupLocksTask dh |
|
100 | 104 |
finally |
101 | 105 |
(forever $ runWConfdMonadInt (listener (handler dh) server) dh) |
102 | 106 |
(liftIO $ closeServer server) |
Also available in: Unified diff