Close socket on exception anyway
authorunc0rr
Mon, 03 Nov 2008 09:43:03 +0000
changeset 1463 659157f76171
parent 1462 d3323637da1f
child 1464 693db7cd6f25
Close socket on exception anyway
netserver/hedgewars-server.hs
--- a/netserver/hedgewars-server.hs	Sun Nov 02 20:48:10 2008 +0000
+++ b/netserver/hedgewars-server.hs	Mon Nov 03 09:43:03 2008 +0000
@@ -61,7 +61,7 @@
 	unless (null recipients) $ putStrLn ("< " ++ (show answer))
 
 	clHandles' <- forM recipients $
-		\ch -> Control.Exception.handle (\e -> putStrLn ("handle exception: " ++ show e) >> if head answer == "BYE" then return [ch] else return []) $ -- cannot just remove
+		\ch -> Control.Exception.handle (\e -> putStrLn ("handle exception: " ++ show e) >> hClose ch >> if head answer == "BYE" then return [ch] else return []) $ -- cannot just remove
 			do
 			forM_ answer (\str -> hPutStrLn ch str)
 			hPutStrLn ch ""