on master help sign in
specifying the correct timeout handler for a worker (#593)
efc0fd2Kazu Yamamoto
warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+1−1
@@ -80,7 +80,7 @@ mkRequest' ii1 settings addr ref (reqths,reqvt) (bodylen,body) = return (req,ii)
80 !rawPath = if S.settingsNoParsePath settings then unparsedPath else path
80 !rawPath = if S.settingsNoParsePath settings then unparsedPath else path
81 !h = hashByteString rawPath
81 !h = hashByteString rawPath
82 !ii = toInternalInfo ii1 h
82 !ii = toInternalInfo ii1 h
83− !th = threadHandle ii
83+ !th = threadHandle ii -- th must be overwritten with worker's one.
84 !vaultValue = Vault.insert pauseTimeoutKey (Timeout.pause th)
84 !vaultValue = Vault.insert pauseTimeoutKey (Timeout.pause th)
85 $ Vault.insert getFileInfoKey (getFileInfo ii)
85 $ Vault.insert getFileInfoKey (getFileInfo ii)
86 $ Vault.insert getHTTP2DataKey (readIORef ref)
86 $ Vault.insert getHTTP2DataKey (readIORef ref)
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+4−2
@@ -219,8 +219,9 @@ response settings ctx@Context{outputQ} mgr ii reqvt tconf strm req rsp = case rs
219 !out = Output strm rspn ii tell h2data rspnOrWait
219 !out = Output strm rspn ii tell h2data rspnOrWait
220 enqueueOutput outputQ out
220 enqueueOutput outputQ out
221 let push b = do
221 let push b = do
222+ T.pause th
222 atomically $ writeTBQueue tbq (SBuilder b)
223 atomically $ writeTBQueue tbq (SBuilder b)
223− T.tickle th
224+ T.resume th
224 flush = atomically $ writeTBQueue tbq SFlush
225 flush = atomically $ writeTBQueue tbq SFlush
225 _ <- strmbdy push flush
226 _ <- strmbdy push flush
226 atomically $ writeTBQueue tbq SFinish
227 atomically $ writeTBQueue tbq SFinish
@@ -242,7 +243,8 @@ worker ctx@Context{inputQ,controlQ} set app responder tm = do
242 setStreamInfo sinfo inp
243 setStreamInfo sinfo inp
243 T.resume th
244 T.resume th
244 T.tickle th
245 T.tickle th
246+ let ii' = ii { threadHandle = th }
245− app req $ responder ii reqvt tcont strm req
247+ app req $ responder ii' reqvt tcont strm req
246 cont1 <- case ex of
248 cont1 <- case ex of
247 Right ResponseReceived -> return True
249 Right ResponseReceived -> return True
248 Left e@(SomeException _)
250 Left e@(SomeException _)