@@ -10,23 +10,24 @@
10-- Applications that use the TCP transport should use
10-- Applications that use the TCP transport should use
11-- 'Network.Socket.withSocketsDo' in their main function for Windows
11-- 'Network.Socket.withSocketsDo' in their main function for Windows
12-- compatibility (see "Network.Socket").
12-- compatibility (see "Network.Socket").
13−module Network.Transport.TCP ( -- * Main API
13+module Network.Transport.TCP
14− createTransport
15+ createTransport
15− , TCPParameters(..)
16+ , TCPParameters(..)
16− , defaultTCPParameters
17+ , defaultTCPParameters
17− -- * Internals (exposed for unit tests)
18+ -- * Internals (exposed for unit tests)
18− , createTransportExposeInternals
19+ , createTransportExposeInternals
19− , TransportInternals(..)
20+ , TransportInternals(..)
20− , EndPointId
21+ , EndPointId
21− , encodeEndPointAddress
22+ , encodeEndPointAddress
22− , decodeEndPointAddress
23+ , decodeEndPointAddress
23− , ControlHeader(..)
24+ , ControlHeader(..)
24− , ConnectionRequestResponse(..)
25+ , ConnectionRequestResponse(..)
25− , firstNonReservedConnectionId
26+ , firstNonReservedConnectionId
26− , socketToEndPoint
27+ , socketToEndPoint
27− -- * Design notes
28+ -- * Design notes
28− -- $design
29+ -- $design
31import Prelude hiding
32import Prelude hiding
@@ -36,64 +37,69 @@ import Prelude hiding
38import Network.Transport
39import Network.Transport
39−import Network.Transport.TCP.Internal ( forkServer
40+import Network.Transport.TCP.Internal
40− , recvWithLength
42+ , recvWithLength
41− , recvInt32
43+ , recvInt32
42− , tryCloseSocket
44+ , tryCloseSocket
44−import Network.Transport.Internal ( encodeInt32
46+import Network.Transport.Internal
45− , decodeInt32
48+ , decodeInt32
46− , prependLength
49+ , prependLength
47− , mapIOException
50+ , mapIOException
49− , tryToEnum
52+ , tryToEnum
51− , timeoutMaybe
54+ , timeoutMaybe
52− , asyncWhenCancelled
55+ , asyncWhenCancelled
54−import qualified Network.Socket as N ( HostName
57+import qualified Network.Socket as N
55− , ServiceName
59+ , ServiceName
57− , getAddrInfo
61+ , getAddrInfo
59− , addrFamily
63+ , addrFamily
60− , addrAddress
64+ , addrAddress
61− , SocketType(Stream)
65+ , SocketType(Stream)
62− , defaultProtocol
66+ , defaultProtocol
63− , setSocketOption
67+ , setSocketOption
64− , SocketOption(ReuseAddr)
68+ , SocketOption(ReuseAddr)
65− , connect
69+ , connect
66− , sOMAXCONN
70+ , sOMAXCONN
67− , AddrInfo
71+ , AddrInfo
69import Network.Socket.ByteString (sendMany)
73import Network.Socket.ByteString (sendMany)
70import Control.Concurrent (forkIO, ThreadId, killThread, myThreadId)
74import Control.Concurrent (forkIO, ThreadId, killThread, myThreadId)
71import Control.Concurrent.Chan (Chan, newChan, readChan, writeChan)
75import Control.Concurrent.Chan (Chan, newChan, readChan, writeChan)
72−import Control.Concurrent.MVar ( MVar
76+import Control.Concurrent.MVar
73− , newMVar
78+ , newMVar
74− , modifyMVar
79+ , modifyMVar
75− , modifyMVar_
80+ , modifyMVar_
76− , readMVar
81+ , readMVar
77− , takeMVar
82+ , takeMVar
78− , putMVar
83+ , putMVar
79− , newEmptyMVar
84+ , newEmptyMVar
80− , withMVar
85+ , withMVar
82import Control.Category ((>>>))
87import Control.Category ((>>>))
83import Control.Applicative ((<$>))
88import Control.Applicative ((<$>))
84import Control.Monad (when, unless)
89import Control.Monad (when, unless)
85−import Control.Exception ( IOException
90+import Control.Exception
86− , SomeException
92+ , SomeException
87− , AsyncException
93+ , AsyncException
90− , throwIO
96+ , throwIO
92− , bracketOnError
98+ , bracketOnError
94− , onException
100+ , onException
95− , fromException
101+ , fromException
97import Data.IORef (IORef, newIORef, writeIORef, readIORef)
103import Data.IORef (IORef, newIORef, writeIORef, readIORef)
98import Data.ByteString (ByteString)
104import Data.ByteString (ByteString)
99import qualified Data.ByteString as BS (concat)
105import qualified Data.ByteString as BS (concat)
@@ -102,14 +108,15 @@ import Data.Int (Int32)
102import Data.IntMap (IntMap)
108import Data.IntMap (IntMap)
103import qualified Data.IntMap as IntMap (empty)
109import qualified Data.IntMap as IntMap (empty)
104import Data.IntSet (IntSet)
110import Data.IntSet (IntSet)
105−import qualified Data.IntSet as IntSet ( empty
111+import qualified Data.IntSet as IntSet
106− , insert
113+ , insert
108− , singleton
115+ , singleton
110− , delete
117+ , delete
111− , member
118+ , member
113import Data.Map (Map)
120import Data.Map (Map)
114import qualified Data.Map as Map (empty)
121import qualified Data.Map as Map (empty)
115import Data.Accessor (Accessor, accessor, (^.), (^=), (^:))
122import Data.Accessor (Accessor, accessor, (^.), (^=), (^:))