@@ -102,11 +102,9 @@ frameSender ctx@Context{outputQ,connectionWindow,wait}
102102 Next datPayloadLen mnext <- fillResponseBodyGetNext conn ii datPayloadOff lim rsp
103103 fillDataHeaderSend strm total datPayloadLen mnext pri
104104 else do
105− -- Some implementation send the next request
106− -- immediately after receiving end of stream
107− -- even IP packets of the tail portion of DATA frame
108− -- is not received. So, decrease the concurrency counter
109− -- first.
105+ -- "closed" must be before "connSendAll". If not,
106+ -- the context would be switched to the receiver,
107+ -- resulting the inconsistency of concurrency.
110108 closed ctx strm Finished
111109 bufferIO connWriteBuffer total connSendAll
112110 Persist sq tvar -> do
@@ -160,11 +158,9 @@ frameSender ctx@Context{outputQ,connectionWindow,wait}
160158 CFinish -> setEndStream defaultFlags
161159 _ -> defaultFlags
162160 fillFrameHeader FrameData datPayloadLen sid flag buf
163− -- Some implementation send the next request
164− -- immediately after receiving end of stream
165− -- even IP packets of the tail portion of DATA frame
166− -- is not received. So, decrease the concurrency counter
167− -- first.
161+ -- "closed" must be before "connSendAll". If not,
162+ -- the context would be switched to the receiver,
163+ -- resulting the inconsistency of concurrency.
168164 case mnext of
169165 CFinish -> closed ctx strm Finished
170166 _ -> return ()