on master help sign in
logging quickly to not hold Request.
commit35870c864a3b386f172853c37a4f3f073b062948 authorKazu Yamamoto <kazu@iij.ad.jp> dateWed 16 Dec 2015, 14:12 (11 years ago) parent729010f
3 files changed+4−11
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+1−3 warp/Network/Wai/Handler/Warp/HTTP2/Types.hs−2 warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+3−6
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+1−3
@@ -222,9 +222,7 @@ frameSender ctx@Context{outputQ,connectionWindow,encodeDynamicTable}
222222 -- the context would be switched to the receiver,
223223 -- resulting the inconsistency of concurrency.
224224 case mnext of
225− CFinish -> do closed ctx strm Finished
226− logger <- readIORef $ streamLogger strm
227− logger
225+ CFinish -> closed ctx strm Finished
228226 _ -> return ()
229227 flushN total
230228 atomically $ do
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs−2
@@ -183,7 +183,6 @@ data Stream = Stream {
183183 , streamBodyLength :: !(IORef Int)
184184 , streamWindow :: !(TVar WindowSize)
185185 , streamPrecedence :: !(IORef Precedence)
186− , streamLogger :: !(IORef (IO ()))
187186 }
188187
189188instance Show Stream where
@@ -195,7 +194,6 @@ newStream sid win = Stream sid <$> newIORef Idle
195194 <*> newIORef 0
196195 <*> newTVarIO win
197196 <*> newIORef defaultPrecedence
198− <*> newIORef (return ())
199197
200198----------------------------------------------------------------
201199
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+3−6
@@ -71,8 +71,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
7171 responseNoBody s hs = responseBuilderBody s hs mempty
7272
7373 responseBuilderBody s hs bdy = do
74− let !logact = logger s Nothing
75− writeIORef (streamLogger strm) logact
74+ logger s Nothing
7675 setThreadContinue tconf True
7776 let rsp' = ResponseBuilder s hs bdy
7877 out = OResponse strm rsp' (Oneshot True)
@@ -92,8 +91,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
9291 responseFile2XX s hs path mpart
9392 | isHead = responseNoBody s hs
9493 | otherwise = do
95− let !logact = logger s (filePartByteCount <$> mpart)
96− writeIORef (streamLogger strm) logact
94+ logger s (filePartByteCount <$> mpart)
9795 setThreadContinue tconf True
9896 let rsp' = ResponseFile s hs path mpart
9997 out = OResponse strm rsp' (Oneshot True)
@@ -107,8 +105,7 @@ response ii settings Context{outputQ} mgr tconf th strm req rsp
107105 body = byteString "File not found"
108106
109107 responseStreaming strmbdy = do
110− let !logact = logger s0 Nothing
111− writeIORef (streamLogger strm) logact
108+ logger s0 Nothing
112109 -- We must not exit this WAI application.
113110 -- If the application exits, streaming would be also closed.
114111 -- So, this work occupies this thread.