netserver/hedgewars-server.hs
changeset 1392 dc6a772ea385
parent 1391 735f6d43780b
child 1393 6d04732abed2
equal deleted inserted replaced
1391:735f6d43780b 1392:dc6a772ea385
    45 sendAnswers ((handlesFunc, answer):answers) client clients rooms = do
    45 sendAnswers ((handlesFunc, answer):answers) client clients rooms = do
    46 	let recipients = handlesFunc client clients rooms
    46 	let recipients = handlesFunc client clients rooms
    47 	unless (null recipients) $ putStrLn ("< " ++ (show answer))
    47 	unless (null recipients) $ putStrLn ("< " ++ (show answer))
    48 
    48 
    49 	clHandles' <- forM recipients $
    49 	clHandles' <- forM recipients $
    50 		\ch -> Control.Exception.handle (\e -> putStrLn (show e) >> hClose ch >> return []) $ -- cannot just remove
    50 		\ch -> Control.Exception.handle (\e -> putStrLn ("handle exception: " ++ show e) >> hClose ch >> return []) $ -- cannot just remove
    51 			do
    51 			do
    52 			forM_ answer (\str -> hPutStrLn ch str)
    52 			forM_ answer (\str -> hPutStrLn ch str)
    53 			hPutStrLn ch ""
    53 			hPutStrLn ch ""
    54 			hFlush ch
    54 			hFlush ch
    55 			if (not $ null answer) && (head answer == "BYE") then hClose ch >> return [ch] else return []
    55 			if (not $ null answer) && (head answer == "BYE") then hClose ch >> return [ch] else return []