If exception is on client quit, then just remove that client
authorunc0rr
Tue, 21 Oct 2008 18:31:40 +0000
changeset 1394 962001cfcf48
parent 1393 6d04732abed2
child 1395 46fd70de89e2
If exception is on client quit, then just remove that client
netserver/hedgewars-server.hs
--- a/netserver/hedgewars-server.hs	Tue Oct 21 18:29:21 2008 +0000
+++ b/netserver/hedgewars-server.hs	Tue Oct 21 18:31:40 2008 +0000
@@ -47,12 +47,12 @@
 	unless (null recipients) $ putStrLn ("< " ++ (show answer))
 
 	clHandles' <- forM recipients $
-		\ch -> Control.Exception.handle (\e -> putStrLn ("handle exception: " ++ show e) >> return []) $ -- cannot just remove
+		\ch -> Control.Exception.handle (\e -> putStrLn ("handle exception: " ++ show e) >> if head answer == "BYE" then return [ch] else return []) $ -- cannot just remove
 			do
 			forM_ answer (\str -> hPutStrLn ch str)
 			hPutStrLn ch ""
 			hFlush ch
-			if (not $ null answer) && (head answer == "BYE") then hClose ch >> return [ch] else return []
+			if head answer == "BYE" then hClose ch >> return [ch] else return []
 
 	let mclients = remove clients $ concat clHandles'