@@ -122,16 +122,16 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
122 Nothing -> return ()
122 Nothing -> return ()
123 Just siz -> setLimitForEncoding siz encodeDynamicTable
123 Just siz -> setLimitForEncoding siz encodeDynamicTable
125− output (ONext strm curr mtbq tell) off0 lim = do
125+ output out@(Output strm _ _ tell (ONext curr)) off0 lim = do
126 -- Data frame payload
126 -- Data frame payload
127 let !buf = connWriteBuffer `plusPtr` off0
127 let !buf = connWriteBuffer `plusPtr` off0
128 !siz = connBufferSize - off0
128 !siz = connBufferSize - off0
129 Next datPayloadLen mnext <- curr buf siz lim
129 Next datPayloadLen mnext <- curr buf siz lim
130 off <- fillDataHeader strm off0 datPayloadLen mnext tell
130 off <- fillDataHeader strm off0 datPayloadLen mnext tell
131− maybeEnqueueNext strm mtbq mnext tell
131+ maybeEnqueueNext out mnext
132 return off
132 return off
134− output (ORspn strm rspn ii tell) off0 lim = do
134+ output out@(Output strm rspn ii tell ORspn) off0 lim = do
135 -- Header frame and Continuation frame
135 -- Header frame and Continuation frame
136 let !sid = streamNumber strm
136 let !sid = streamNumber strm
137 !endOfStream = case rspn of
137 !endOfStream = case rspn of
@@ -150,7 +150,7 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
150 Next datPayloadLen mnext <-
150 Next datPayloadLen mnext <-
151 fillFileBodyGetNext conn ii payloadOff lim path mpart
151 fillFileBodyGetNext conn ii payloadOff lim path mpart
152 off' <- fillDataHeader strm off datPayloadLen mnext tell
152 off' <- fillDataHeader strm off datPayloadLen mnext tell
153− maybeEnqueueNext strm Nothing mnext tell
153+ maybeEnqueueNext out mnext
154 return off'
154 return off'
155 RspnBuilder _ _ builder -> do
155 RspnBuilder _ _ builder -> do
156 -- Data frame payload
156 -- Data frame payload
@@ -158,23 +158,23 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
158 Next datPayloadLen mnext <-
158 Next datPayloadLen mnext <-
159 fillBuilderBodyGetNext conn ii payloadOff lim builder
159 fillBuilderBodyGetNext conn ii payloadOff lim builder
160 off' <- fillDataHeader strm off datPayloadLen mnext tell
160 off' <- fillDataHeader strm off datPayloadLen mnext tell
161− maybeEnqueueNext strm Nothing mnext tell
161+ maybeEnqueueNext out mnext
162 return off'
162 return off'
163 RspnStreaming _ _ tbq -> do
163 RspnStreaming _ _ tbq -> do
164 let payloadOff = off + frameHeaderLength
164 let payloadOff = off + frameHeaderLength
165 Next datPayloadLen mnext <-
165 Next datPayloadLen mnext <-
166 fillStreamBodyGetNext conn payloadOff lim tbq strm
166 fillStreamBodyGetNext conn payloadOff lim tbq strm
167 off' <- fillDataHeader strm off datPayloadLen mnext tell
167 off' <- fillDataHeader strm off datPayloadLen mnext tell
168− maybeEnqueueNext strm (Just tbq) mnext tell
168+ maybeEnqueueNext out mnext
169 return off'
169 return off'
171− output (OPush strm ths rspn ii tell pid) off0 lim = do
171+ output (Output strm rspn ii tell (OPush ths pid)) off0 lim = do
172 -- Creating a push promise header
172 -- Creating a push promise header
173 -- Frame id should be associated stream id from the client.
173 -- Frame id should be associated stream id from the client.
174 let !sid = streamNumber strm
174 let !sid = streamNumber strm
175 len <- pushPromise pid sid ths off0
175 len <- pushPromise pid sid ths off0
176 off <- sendHeadersIfNecessary $ off0 + frameHeaderLength + len
176 off <- sendHeadersIfNecessary $ off0 + frameHeaderLength + len
177− output (ORspn strm rspn ii tell) off lim
177+ output (Output strm rspn ii tell ORspn) off lim
179 output _ _ _ = undefined -- never reach
179 output _ _ _ = undefined -- never reach
@@ -183,9 +183,9 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
183 if isClosed state then
183 if isClosed state then
184 return off
184 return off
185 else case out of
185 else case out of
186− OWait strm' rsp ii wait -> do
186+ Output strm' rsp ii wait OWait -> do
187 -- Checking if all push are done.
187 -- Checking if all push are done.
188− let out' = ORspn strm' rsp ii (return ())
188+ let out' = Output strm' rsp ii (return ()) ORspn
189 forkAndEnqueueWhenReady wait outputQ out' mgr
189 forkAndEnqueueWhenReady wait outputQ out' mgr
190 return off
190 return off
191 _ -> case mtbq of
191 _ -> case mtbq of
@@ -252,12 +252,11 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
253 {-# INLINE maybeEnqueueNext #-}
253 {-# INLINE maybeEnqueueNext #-}
254 -- Re-enqueue the stream in the output queue.
254 -- Re-enqueue the stream in the output queue.
255− maybeEnqueueNext :: Stream -> Maybe (TBQueue Sequence)
256− -> Maybe DynaNext -> IO () -> IO ()
255+ maybeEnqueueNext :: Output -> Maybe DynaNext -> IO ()
257− maybeEnqueueNext _ _ Nothing _ = return ()
256+ maybeEnqueueNext _ Nothing = return ()
258− maybeEnqueueNext strm mtbq (Just next) tell = enqueueOutput outputQ out
257+ maybeEnqueueNext out (Just next) = enqueueOutput outputQ out'
260− !out = ONext strm next mtbq tell
259+ !out' = out { outputType = ONext next }
262 {-# INLINE sendHeadersIfNecessary #-}
261 {-# INLINE sendHeadersIfNecessary #-}
263 -- Send headers if there is not room for a 1-byte data frame, and return
262 -- Send headers if there is not room for a 1-byte data frame, and return