@@ -9,19 +9,18 @@ import Control.Concurrent (forkIO)
99import Control.Concurrent.Chan
1010import Control.Concurrent.MVar
1111import Control.Monad (forever, unless)
12−import Data.ByteString.Char8 (ByteString)
12+import Data.ByteString.Lazy.Char8 (ByteString)
1313import Data.IntMap (IntMap)
14−import Data.Word
1514import Network.Socket
1615import Safe
1716
18−import qualified Data.ByteString.Char8 as BS
17+import qualified Data.ByteString.Lazy.Char8 as BS
1918import qualified Data.IntMap as IntMap
2019import qualified Network.Socket as N
21−import qualified Network.Socket.ByteString as NBS
20+import qualified Network.Socket.ByteString.Lazy as NBS
2221
23−type Chans = MVar (Int, IntMap (Chan ByteString))
24−type ChanId = Int
22+type ChanId = Int
23+type Chans = MVar (ChanId, IntMap (Chan ByteString))
2524
2625-- | This deals with several different configuration properties:
2726-- * Buffer size, specified in Hints
@@ -56,7 +55,7 @@ mkTransport (TCPConfig _hints host service) = withSocketsDo $ do
5655 chan <- newChan
5756 putMVar channels (chanId + 1, IntMap.insert chanId chan chanMap)
5857 return (mkSourceAddr host service chanId, mkTargetEnd chan)
59− , newMulticastWith = undefined
58+ , newMulticastWith = error "newMulticastWith: not defined"
6059 , deserialize = \bs ->
6160 case readMay . BS.unpack $ bs of
6261 Nothing -> error "deserialize: cannot parse"
@@ -80,8 +79,8 @@ mkTransport (TCPConfig _hints host service) = withSocketsDo $ do
8079 setSocketOption sock ReuseAddr 1
8180 N.connect sock (addrAddress serverAddr)
8281 NBS.sendAll sock $ BS.pack . show $ chanId
83− return $ SourceEnd
84− { Network.Transport.send = \bss -> NBS.sendMany sock bss
82+ return SourceEnd
83+ { Network.Transport.send = mapM_ (NBS.send sock)
8584 }
8685
8786 mkTargetEnd :: Chan ByteString -> TargetEnd