netserver/newhwserv.hs
changeset 1309 1a38a967bd48
parent 1308 d5dcd6cfa5e2
child 1321 d7dc4e86201e
--- a/netserver/newhwserv.hs	Mon Oct 06 18:37:47 2008 +0000
+++ b/netserver/newhwserv.hs	Mon Oct 06 18:40:47 2008 +0000
@@ -36,7 +36,7 @@
 clientLoop handle chan =
 	listenLoop handle [] chan
 		`catch` (const $ clientOff >> return ())
-	where clientOff = atomically $ writeTChan chan ["QUIT"] -- если клиент отключается, то делаем вид, что от него пришла команда QUIT
+	where clientOff = atomically $ writeTChan chan ["QUIT"] -- if the client disconnects, we perform as if it sent QUIT message
 
 
 sendAnswers [] _ clients _ = return clients
@@ -46,6 +46,7 @@
 
 	clHandles' <- forM recipients $
 		\ch -> Control.Exception.handle (\e -> putStrLn (show e) >> hClose ch >> return [ch]) $
+			if (not $ null answer) && (head answer == "off") then hClose ch >> return [ch] else -- probably client with exception, don't send him anything
 			do
 			forM_ answer (\str -> hPutStrLn ch str)
 			hPutStrLn ch ""