diff -r 149244d86bf1 -r 2ca76a7f3121 netserver/newhwserv.hs --- a/netserver/newhwserv.hs Wed Apr 30 20:48:12 2008 +0000 +++ b/netserver/newhwserv.hs Thu May 01 14:30:12 2008 +0000 @@ -16,7 +16,7 @@ (cHandle, host, port) <- accept servSock cChan <- atomically newTChan forkIO $ clientLoop cHandle cChan - atomically $ writeTChan acceptChan (ClientInfo cChan cHandle "" "" False) + atomically $ writeTChan acceptChan (ClientInfo cChan cHandle "" 0 "" False) acceptLoop servSock acceptChan listenLoop :: Handle -> TChan String -> IO () @@ -29,7 +29,6 @@ clientLoop handle chan = listenLoop handle chan `catch` (const $ clientOff >> return ()) - `finally` hClose handle where clientOff = atomically $ writeTChan chan "QUIT" mainLoop :: Socket -> TChan ClientInfo -> [ClientInfo] -> [RoomInfo] -> IO () @@ -48,7 +47,7 @@ return [] `catch` const (hClose (handle ci) >> return [ci]) - client' <- if head strs == "QUIT" then hClose (handle client) >> return [client] else return [] + client' <- if (not $ null strs) && (head strs == "QUIT") then hClose (handle client) >> return [client] else return [] mainLoop servSock acceptChan (remove (remove (mclient : filter (\cl -> handle cl /= handle client) clients) (concat clients')) client') mrooms where