on master help sign in
flipping members.
2de0e76Kazu Yamamoto
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+3−3
@@ -94,7 +94,7 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
94 setLimitForEncoding siz dyntbl
94 setLimitForEncoding siz dyntbl
95 loop
95 loop
96
96
97− output out@(ONext strm curr binfo) = do
97+ output out@(ONext strm binfo curr) = do
98 whenReadyOrEnqueueAgain strm binfo out $ \sws -> do
98 whenReadyOrEnqueueAgain strm binfo out $ \sws -> do
99 cws <- atomically $ readTVar connectionWindow
99 cws <- atomically $ readTVar connectionWindow
100 let !lim = min cws sws
100 let !lim = min cws sws
@@ -103,7 +103,7 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
103 fillDataHeaderSend strm 0 datPayloadLen mnext
103 fillDataHeaderSend strm 0 datPayloadLen mnext
104 maybeEnqueueNext strm mnext binfo
104 maybeEnqueueNext strm mnext binfo
105 loop
105 loop
106− output out@(OResponse strm rsp binfo) = do
106+ output out@(OResponse strm binfo rsp) = do
107 whenReadyOrEnqueueAgain strm binfo out $ \sws -> do
107 whenReadyOrEnqueueAgain strm binfo out $ \sws -> do
108 -- Header frame and Continuation frame
108 -- Header frame and Continuation frame
109 let sid = streamNumber strm
109 let sid = streamNumber strm
@@ -210,7 +210,7 @@ frameSender ctx@Context{outputQ,controlQ,connectionWindow,encodeDynamicTable}
210 -- Re-enqueue the stream in the output queue.
210 -- Re-enqueue the stream in the output queue.
211 maybeEnqueueNext :: Stream -> Maybe DynaNext -> BodyInfo -> IO ()
211 maybeEnqueueNext :: Stream -> Maybe DynaNext -> BodyInfo -> IO ()
212 maybeEnqueueNext strm (Just next) binfo = do
212 maybeEnqueueNext strm (Just next) binfo = do
213− let !out = ONext strm next binfo
213+ let !out = ONext strm binfo next
214 enqueueOutput outputQ out
214 enqueueOutput outputQ out
215 maybeEnqueueNext _ _ _ = return ()
215 maybeEnqueueNext _ _ _ = return ()
216
216
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+6−2
@@ -51,13 +51,17 @@ type BytesFilled = Int
51
51
52data Next = Next !BytesFilled (Maybe DynaNext)
52data Next = Next !BytesFilled (Maybe DynaNext)
53
53
54−data Output = OResponse !Stream !Response !BodyInfo
54+data Output = OResponse !Stream !BodyInfo !Response
55− | ONext !Stream !DynaNext !BodyInfo
55+ | ONext !Stream !BodyInfo !DynaNext
56
56
57outputStream :: Output -> Stream
57outputStream :: Output -> Stream
58outputStream (OResponse strm _ _) = strm
58outputStream (OResponse strm _ _) = strm
59outputStream (ONext strm _ _) = strm
59outputStream (ONext strm _ _) = strm
60
60
61+outputBodyInfo :: Output -> BodyInfo
62+outputBodyInfo (OResponse _ binfo _) = binfo
63+outputBodyInfo (ONext _ binfo _) = binfo
64+
61data Control = CFinish
65data Control = CFinish
62 | CGoaway !ByteString
66 | CGoaway !ByteString
63 | CFrame !ByteString
67 | CFrame !ByteString
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+3−3
@@ -79,7 +79,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
79 logger req s Nothing
79 logger req s Nothing
80 setThreadContinue tconf True
80 setThreadContinue tconf True
81 let rsp' = ResponseBuilder s hs bdy
81 let rsp' = ResponseBuilder s hs bdy
82− out = OResponse strm rsp' binfo
82+ out = OResponse strm binfo rsp'
83 enqueueOutput outputQ out
83 enqueueOutput outputQ out
84 return ResponseReceived
84 return ResponseReceived
85
85
@@ -101,7 +101,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
101 logger req s (filePartByteCount <$> mpart)
101 logger req s (filePartByteCount <$> mpart)
102 setThreadContinue tconf True
102 setThreadContinue tconf True
103 let rsp' = ResponseFile s hs path mpart
103 let rsp' = ResponseFile s hs path mpart
104− out = OResponse strm rsp' OneshotWithBody
104+ out = OResponse strm OneshotWithBody rsp'
105 enqueueOutput outputQ out
105 enqueueOutput outputQ out
106 return ResponseReceived
106 return ResponseReceived
107
107
@@ -125,7 +125,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
125 -- Since 'StreamingBody' is loop, we cannot control it.
125 -- Since 'StreamingBody' is loop, we cannot control it.
126 -- So, let's serialize 'Builder' with a designated queue.
126 -- So, let's serialize 'Builder' with a designated queue.
127 sq <- newTBQueueIO 10 -- fixme: hard coding: 10
127 sq <- newTBQueueIO 10 -- fixme: hard coding: 10
128− let out = OResponse strm rsp (Persist sq)
128+ let out = OResponse strm (Persist sq) rsp
129 enqueueOutput outputQ out
129 enqueueOutput outputQ out
130 let push b = do
130 let push b = do
131 atomically $ writeTBQueue sq (SBuilder b)
131 atomically $ writeTBQueue sq (SBuilder b)