gameServer/ClientIO.hs
changeset 15699 27eb5abd5058
parent 13673 1aa5e884326a
child 15983 2c92499daa67
equal deleted inserted replaced
15698:f681c3f2eeba 15699:27eb5abd5058
    21 
    21 
    22 import qualified Control.Exception as Exception
    22 import qualified Control.Exception as Exception
    23 import Control.Monad.State
    23 import Control.Monad.State
    24 import Control.Concurrent.Chan
    24 import Control.Concurrent.Chan
    25 import Control.Concurrent
    25 import Control.Concurrent
    26 import Network
    26 import Network.Socket hiding (recv)
    27 import Network.Socket.ByteString
    27 import Network.Socket.ByteString
    28 import qualified Data.ByteString.Char8 as B
    28 import qualified Data.ByteString.Char8 as B
    29 ----------------
    29 ----------------
    30 import CoreTypes
    30 import CoreTypes
    31 import RoomsAndClients
    31 import RoomsAndClients
    88     Exception.handle
    88     Exception.handle
    89         (\(e :: Exception.SomeException) -> unless (isQuit answer) . killReciever $ show e) $
    89         (\(e :: Exception.SomeException) -> unless (isQuit answer) . killReciever $ show e) $
    90             sendAll s $ B.unlines answer `B.snoc` '\n'
    90             sendAll s $ B.unlines answer `B.snoc` '\n'
    91 
    91 
    92     if isQuit answer then
    92     if isQuit answer then
    93         sClose s
    93         close s
    94         else
    94         else
    95         clientSendLoop s tId chan ci
    95         clientSendLoop s tId chan ci
    96 
    96 
    97     where
    97     where
    98         killReciever = Exception.throwTo tId . ShutdownThreadException
    98         killReciever = Exception.throwTo tId . ShutdownThreadException