netserver/hedgewars-server.hs
changeset 1398 29eedf717d0f
parent 1397 471c42a1c358
child 1403 b8c921ed0f13
equal deleted inserted replaced
1397:471c42a1c358 1398:29eedf717d0f
    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