on master help sign in
making more strict.
commitbaca2c15c709a2d3c51c4bc00171583c3edbefc4 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 10 Dec 2015, 16:25 (11 years ago) parent7887f08
2 files changed+37−37
warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs+3−3 warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+34−34
warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs+3−3
@@ -92,7 +92,7 @@ frameReceiver ctx mkreq recvN = loop `E.catch` sendGoaway
9292 control ftyp header pl ctx
9393 | otherwise = do
9494 checkContinued
95− strm@Stream{streamState,streamContentLength,streamPrecedence} <- getStream
95+ !strm@Stream{streamState,streamContentLength,streamPrecedence} <- getStream
9696 pl <- recvN payloadLength
9797 state <- readIORef streamState
9898 state' <- stream ftyp header pl ctx state strm
@@ -105,7 +105,7 @@ frameReceiver ctx mkreq recvN = loop `E.catch` sendGoaway
105105 E.throwIO $ StreamError ProtocolError streamId
106106 writeIORef streamPrecedence $ toPrecedence pri
107107 writeIORef streamState HalfClosed
108− let req = mkreq vh (return "")
108+ let !req = mkreq vh (return "")
109109 atomically $ writeTQueue inputQ $ Input strm req
110110 Nothing -> E.throwIO $ StreamError ProtocolError streamId
111111 Open (HasBody hdr pri) -> do
@@ -118,7 +118,7 @@ frameReceiver ctx mkreq recvN = loop `E.catch` sendGoaway
118118 writeIORef streamContentLength $ vhCL vh
119119 readQ <- newReadBody q
120120 bodySource <- mkSource readQ
121− let req = mkreq vh (readSource bodySource)
121+ let !req = mkreq vh (readSource bodySource)
122122 atomically $ writeTQueue inputQ $ Input strm req
123123 Nothing -> E.throwIO $ StreamError ProtocolError streamId
124124 s@(Open Continued{}) -> do
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+34−34
@@ -57,14 +57,14 @@ type DynaNext = WindowSize -> IO Next
5757
5858type BytesFilled = Int
5959
60−data Next = Next BytesFilled (Control DynaNext)
60+data Next = Next !BytesFilled (Control DynaNext)
6161
6262data Output = OFinish
63− | OGoaway ByteString
64− | OFrame ByteString
65− | OSettings ByteString SettingsList
66− | OResponse Stream Response Aux
67− | ONext Stream DynaNext
63+ | OGoaway !ByteString
64+ | OFrame !ByteString
65+ | OSettings !ByteString !SettingsList
66+ | OResponse !Stream !Response !Aux
67+ | ONext !Stream !DynaNext
6868
6969outputStream :: Output -> Stream
7070outputStream (OResponse strm _ _) = strm
@@ -88,21 +88,21 @@ data Aux = Oneshot Bool
8888
8989-- | The context for HTTP/2 connection.
9090data Context = Context {
91− http2settings :: IORef Settings
92− , streamTable :: StreamTable
93− , concurrency :: IORef Int
94− , priorityTreeSize :: IORef Int
91+ http2settings :: !(IORef Settings)
92+ , streamTable :: !StreamTable
93+ , concurrency :: !(IORef Int)
94+ , priorityTreeSize :: !(IORef Int)
9595 -- | RFC 7540 says "Other frames (from any stream) MUST NOT
9696 -- occur between the HEADERS frame and any CONTINUATION
9797 -- frames that might follow". This field is used to implement
9898 -- this requirement.
99− , continued :: IORef (Maybe StreamId)
100− , currentStreamId :: IORef StreamId
101− , inputQ :: TQueue Input
102− , outputQ :: PriorityTree Output
103− , encodeDynamicTable :: IORef DynamicTable
104− , decodeDynamicTable :: IORef DynamicTable
105− , connectionWindow :: TVar WindowSize
99+ , continued :: !(IORef (Maybe StreamId))
100+ , currentStreamId :: !(IORef StreamId)
101+ , inputQ :: !(TQueue Input)
102+ , outputQ :: !(PriorityTree Output)
103+ , encodeDynamicTable :: !(IORef DynamicTable)
104+ , decodeDynamicTable :: !(IORef DynamicTable)
105+ , connectionWindow :: !(TVar WindowSize)
106106 }
107107
108108----------------------------------------------------------------
@@ -128,25 +128,25 @@ clearContext ctx = void $ reaperStop $ streamTable ctx
128128data OpenState =
129129 JustOpened
130130 | Continued [HeaderBlockFragment]
131− Int -- Total size
132− Int -- The number of continuation frames
133− Bool -- End of stream
134− Priority
135− | NoBody HeaderList Priority
136− | HasBody HeaderList Priority
137− | Body (TQueue ByteString)
131+ !Int -- Total size
132+ !Int -- The number of continuation frames
133+ !Bool -- End of stream
134+ !Priority
135+ | NoBody HeaderList !Priority
136+ | HasBody HeaderList !Priority
137+ | Body !(TQueue ByteString)
138138
139139data ClosedCode = Finished
140140 | Killed
141− | Reset ErrorCodeId
141+ | Reset !ErrorCodeId
142142 | ResetByMe SomeException
143143 deriving Show
144144
145145data StreamState =
146146 Idle
147− | Open OpenState
147+ | Open !OpenState
148148 | HalfClosed
149− | Closed ClosedCode
149+ | Closed !ClosedCode
150150
151151isIdle :: StreamState -> Bool
152152isIdle Idle = True
@@ -173,14 +173,14 @@ instance Show StreamState where
173173----------------------------------------------------------------
174174
175175data Stream = Stream {
176− streamNumber :: StreamId
177− , streamState :: IORef StreamState
176+ streamNumber :: !StreamId
177+ , streamState :: !(IORef StreamState)
178178 -- Next two fields are for error checking.
179− , streamContentLength :: IORef (Maybe Int)
180− , streamBodyLength :: IORef Int
181− , streamWindow :: TVar WindowSize
182− , streamPrecedence :: IORef Precedence
183− , streamLogger :: IORef (IO ())
179+ , streamContentLength :: !(IORef (Maybe Int))
180+ , streamBodyLength :: !(IORef Int)
181+ , streamWindow :: !(TVar WindowSize)
182+ , streamPrecedence :: !(IORef Precedence)
183+ , streamLogger :: !(IORef (IO ()))
184184 }
185185
186186instance Show Stream where