@@ -122,16 +122,16 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
122122 Nothing -> return ()
123123 Just siz -> setLimitForEncoding siz encodeDynamicTable
124124
125− output (ONext strm curr mtbq tell) off0 lim = do
125+ output out@(Output strm _ _ tell (ONext curr)) off0 lim = do
126126 -- Data frame payload
127127 let !buf = connWriteBuffer `plusPtr` off0
128128 !siz = connBufferSize - off0
129129 Next datPayloadLen mnext <- curr buf siz lim
130130 off <- fillDataHeader strm off0 datPayloadLen mnext tell
131− maybeEnqueueNext strm mtbq mnext tell
131+ maybeEnqueueNext out mnext
132132 return off
133133
134− output (ORspn strm rspn ii tell) off0 lim = do
134+ output out@(Output strm rspn ii tell ORspn) off0 lim = do
135135 -- Header frame and Continuation frame
136136 let !sid = streamNumber strm
137137 !endOfStream = case rspn of
@@ -150,7 +150,7 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
150150 Next datPayloadLen mnext <-
151151 fillFileBodyGetNext conn ii payloadOff lim path mpart
152152 off' <- fillDataHeader strm off datPayloadLen mnext tell
153− maybeEnqueueNext strm Nothing mnext tell
153+ maybeEnqueueNext out mnext
154154 return off'
155155 RspnBuilder _ _ builder -> do
156156 -- Data frame payload
@@ -158,23 +158,23 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
158158 Next datPayloadLen mnext <-
159159 fillBuilderBodyGetNext conn ii payloadOff lim builder
160160 off' <- fillDataHeader strm off datPayloadLen mnext tell
161− maybeEnqueueNext strm Nothing mnext tell
161+ maybeEnqueueNext out mnext
162162 return off'
163163 RspnStreaming _ _ tbq -> do
164164 let payloadOff = off + frameHeaderLength
165165 Next datPayloadLen mnext <-
166166 fillStreamBodyGetNext conn payloadOff lim tbq strm
167167 off' <- fillDataHeader strm off datPayloadLen mnext tell
168− maybeEnqueueNext strm (Just tbq) mnext tell
168+ maybeEnqueueNext out mnext
169169 return off'
170170
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
172172 -- Creating a push promise header
173173 -- Frame id should be associated stream id from the client.
174174 let !sid = streamNumber strm
175175 len <- pushPromise pid sid ths off0
176176 off <- sendHeadersIfNecessary $ off0 + frameHeaderLength + len
177− output (ORspn strm rspn ii tell) off lim
177+ output (Output strm rspn ii tell ORspn) off lim
178178
179179 output _ _ _ = undefined -- never reach
180180
@@ -183,9 +183,9 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
183183 if isClosed state then
184184 return off
185185 else case out of
186− OWait strm' rsp ii wait -> do
186+ Output strm' rsp ii wait OWait -> do
187187 -- Checking if all push are done.
188− let out' = ORspn strm' rsp ii (return ())
188+ let out' = Output strm' rsp ii (return ()) ORspn
189189 forkAndEnqueueWhenReady wait outputQ out' mgr
190190 return off
191191 _ -> case mtbq of
@@ -252,12 +252,11 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
252252
253253 {-# INLINE maybeEnqueueNext #-}
254254 -- Re-enqueue the stream in the output queue.
255− maybeEnqueueNext :: Stream -> Maybe (TBQueue Sequence)
256− -> Maybe DynaNext -> IO () -> IO ()
257− maybeEnqueueNext _ _ Nothing _ = return ()
258− maybeEnqueueNext strm mtbq (Just next) tell = enqueueOutput outputQ out
255+ maybeEnqueueNext :: Output -> Maybe DynaNext -> IO ()
256+ maybeEnqueueNext _ Nothing = return ()
257+ maybeEnqueueNext out (Just next) = enqueueOutput outputQ out'
259258 where
260− !out = ONext strm next mtbq tell
259+ !out' = out { outputType = ONext next }
261260
262261 {-# INLINE sendHeadersIfNecessary #-}
263262 -- Send headers if there is not room for a 1-byte data frame, and return