equal
deleted
inserted
replaced
11 import Data.List |
11 import Data.List |
12 import Miscutils |
12 import Miscutils |
13 import HWProto |
13 import HWProto |
14 import Opts |
14 import Opts |
15 |
15 |
16 #ifndef WIN32 |
16 #if !defined(mingw32_HOST_OS) |
17 import System.Posix |
17 import System.Posix |
18 #endif |
18 #endif |
19 |
19 |
20 |
20 |
21 acceptLoop :: Socket -> TChan ClientInfo -> IO () |
21 acceptLoop :: Socket -> TChan ClientInfo -> IO () |
99 forkIO $ acceptLoop serverSocket acceptChan |
99 forkIO $ acceptLoop serverSocket acceptChan |
100 mainLoop serverSocket acceptChan [] [] |
100 mainLoop serverSocket acceptChan [] [] |
101 |
101 |
102 |
102 |
103 main = withSocketsDo $ do |
103 main = withSocketsDo $ do |
104 #ifndef WIN32 |
104 #if !defined(mingw32_HOST_OS) |
105 installHandler sigPIPE Ignore Nothing; |
105 installHandler sigPIPE Ignore Nothing; |
106 #endif |
106 #endif |
107 putStrLn $ "Listening on port " ++ show (listenPort globalOptions) |
107 putStrLn $ "Listening on port " ++ show (listenPort globalOptions) |
108 serverSocket <- listenOn $ PortNumber (listenPort globalOptions) |
108 serverSocket <- listenOn $ PortNumber (listenPort globalOptions) |
109 startServer serverSocket `finally` sClose serverSocket |
109 startServer serverSocket `finally` sClose serverSocket |