on master help sign in
specifying the correct timeout handler for a worker (#593)
commitefc0fd2e576a22eb285faa9a842c719ce2b003c4 authorKazu Yamamoto <kazu@iij.ad.jp> dateWed 25 Apr 2018, 16:25 (8 years ago) parent27d79f8
2 files changed+5−3
warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+1−1 warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+4−2
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)
8080 !rawPath = if S.settingsNoParsePath settings then unparsedPath else path
8181 !h = hashByteString rawPath
8282 !ii = toInternalInfo ii1 h
83− !th = threadHandle ii
83+ !th = threadHandle ii -- th must be overwritten with worker's one.
8484 !vaultValue = Vault.insert pauseTimeoutKey (Timeout.pause th)
8585 $ Vault.insert getFileInfoKey (getFileInfo ii)
8686 $ 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
219219 !out = Output strm rspn ii tell h2data rspnOrWait
220220 enqueueOutput outputQ out
221221 let push b = do
222+ T.pause th
222223 atomically $ writeTBQueue tbq (SBuilder b)
223− T.tickle th
224+ T.resume th
224225 flush = atomically $ writeTBQueue tbq SFlush
225226 _ <- strmbdy push flush
226227 atomically $ writeTBQueue tbq SFinish
@@ -242,7 +243,8 @@ worker ctx@Context{inputQ,controlQ} set app responder tm = do
242243 setStreamInfo sinfo inp
243244 T.resume th
244245 T.tickle th
245− app req $ responder ii reqvt tcont strm req
246+ let ii' = ii { threadHandle = th }
247+ app req $ responder ii' reqvt tcont strm req
246248 cont1 <- case ex of
247249 Right ResponseReceived -> return True
248250 Left e@(SomeException _)