netserver/hedgewars-server.hs
changeset 1558 3370b7ffeb5c
parent 1514 c4170faf7b0a
child 1598 c853e02ed663
--- a/netserver/hedgewars-server.hs	Fri Jan 02 09:55:17 2009 +0000
+++ b/netserver/hedgewars-server.hs	Fri Jan 02 13:00:46 2009 +0000
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, ScopedTypeVariables #-}
+{-# LANGUAGE CPP, ScopedTypeVariables, PatternSignatures #-}
 
 module Main where
 
@@ -20,7 +20,6 @@
 import System.Posix
 #endif
 
--- #define IOException Exception
 
 data Messages =
 	Accept ClientInfo
@@ -40,7 +39,7 @@
 
 acceptLoop :: Socket -> TChan ClientInfo -> IO ()
 acceptLoop servSock acceptChan =
-	Control.Exception.handle (\(_ :: IOException) -> putStrLn "exception on connect" >> acceptLoop servSock acceptChan) $
+	Control.Exception.handle (\(_ :: Exception) -> putStrLn "exception on connect" >> acceptLoop servSock acceptChan) $
 	do
 	(cHandle, host, _) <- accept servSock
 	
@@ -77,14 +76,14 @@
 clientSendLoop handle clChan chan = do
 	answer <- atomically $ readTChan chan
 	doClose <- Control.Exception.handle
-		(\(e :: IOException) -> if isQuit answer then return True else sendQuit e >> return False) $ do
+		(\(e :: Exception) -> if isQuit answer then return True else sendQuit e >> return False) $ do
 		forM_ answer (\str -> hPutStrLn handle str)
 		hPutStrLn handle ""
 		hFlush handle
 		return $ isQuit answer
 
 	if doClose then
-		Control.Exception.handle (\(_ :: IOException) -> putStrLn "error on hClose") $ hClose handle
+		Control.Exception.handle (\(_ :: Exception) -> putStrLn "error on hClose") $ hClose handle
 		else
 		clientSendLoop handle clChan chan