on master help sign in
better comments.
cdf40bbKazu Yamamoto
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+6−10
@@ -102,11 +102,9 @@ frameSender ctx@Context{outputQ,connectionWindow,wait}
102 Next datPayloadLen mnext <- fillResponseBodyGetNext conn ii datPayloadOff lim rsp
102 Next datPayloadLen mnext <- fillResponseBodyGetNext conn ii datPayloadOff lim rsp
103 fillDataHeaderSend strm total datPayloadLen mnext pri
103 fillDataHeaderSend strm total datPayloadLen mnext pri
104 else do
104 else do
105− -- Some implementation send the next request
105+ -- "closed" must be before "connSendAll". If not,
106− -- immediately after receiving end of stream
106+ -- the context would be switched to the receiver,
107− -- even IP packets of the tail portion of DATA frame
107+ -- resulting the inconsistency of concurrency.
108− -- is not received. So, decrease the concurrency counter
109− -- first.
110 closed ctx strm Finished
108 closed ctx strm Finished
111 bufferIO connWriteBuffer total connSendAll
109 bufferIO connWriteBuffer total connSendAll
112 Persist sq tvar -> do
110 Persist sq tvar -> do
@@ -160,11 +158,9 @@ frameSender ctx@Context{outputQ,connectionWindow,wait}
160 CFinish -> setEndStream defaultFlags
158 CFinish -> setEndStream defaultFlags
161 _ -> defaultFlags
159 _ -> defaultFlags
162 fillFrameHeader FrameData datPayloadLen sid flag buf
160 fillFrameHeader FrameData datPayloadLen sid flag buf
163− -- Some implementation send the next request
161+ -- "closed" must be before "connSendAll". If not,
164− -- immediately after receiving end of stream
162+ -- the context would be switched to the receiver,
165− -- even IP packets of the tail portion of DATA frame
163+ -- resulting the inconsistency of concurrency.
166− -- is not received. So, decrease the concurrency counter
167− -- first.
168 case mnext of
164 case mnext of
169 CFinish -> closed ctx strm Finished
165 CFinish -> closed ctx strm Finished
170 _ -> return ()
166 _ -> return ()