author | unc0rr |
Fri, 10 Apr 2009 19:56:42 +0000 | |
changeset 1953 | fd9c8e3c734d |
parent 1927 | e2031906a347 |
child 1964 | dc9ea05c9d2f |
permissions | -rw-r--r-- |
1804 | 1 |
{-# LANGUAGE CPP, ScopedTypeVariables, PatternSignatures #-} |
2 |
||
3 |
module Main where |
|
4 |
||
5 |
import Network.Socket |
|
6 |
import qualified Network |
|
7 |
import Control.Concurrent.STM |
|
8 |
import Control.Concurrent.Chan |
|
9 |
import Control.Exception |
|
10 |
import System.Log.Logger |
|
11 |
----------------------------------- |
|
12 |
import Opts |
|
13 |
import CoreTypes |
|
14 |
import OfficialServer.DBInteraction |
|
15 |
import ServerCore |
|
16 |
||
17 |
||
18 |
#if !defined(mingw32_HOST_OS) |
|
19 |
import System.Posix |
|
20 |
#endif |
|
21 |
||
22 |
||
23 |
setupLoggers = |
|
24 |
updateGlobalLogger "Clients" |
|
25 |
(setLevel DEBUG) |
|
26 |
||
27 |
main = withSocketsDo $ do |
|
28 |
#if !defined(mingw32_HOST_OS) |
|
29 |
installHandler sigPIPE Ignore Nothing; |
|
30 |
#endif |
|
31 |
||
32 |
setupLoggers |
|
33 |
||
34 |
stats <- atomically $ newTMVar (StatisticsInfo 0 0) |
|
1833 | 35 |
dbQueriesChan <- newChan |
1804 | 36 |
coreChan <- newChan |
1839
5dd4cb7fd7e5
Server now send ASKPASSWORD command to frontend when user has web account
unc0rr
parents:
1833
diff
changeset
|
37 |
serverInfo <- getOpts $ newServerInfo stats coreChan dbQueriesChan |
1804 | 38 |
|
39 |
bracket |
|
40 |
(Network.listenOn $ Network.PortNumber $ listenPort serverInfo) |
|
41 |
(sClose) |
|
1927
e2031906a347
Ping clients every 30 seconds. Disconnection due to ping timeout to be implemented.
unc0rr
parents:
1839
diff
changeset
|
42 |
(startServer serverInfo) |