Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Oct 31, 2023
1 parent 867c5a9 commit 73d2360
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Network/HTTP2/Client/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ run ClientConfig{..} conf@Config{..} client = do
clientInfo <- newClientInfo scheme authority cacheLimit
ctx <- newContext clientInfo confBufferSize confMySockAddr confPeerSockAddr
mgr <- start confTimeoutManager
let runBackgroundThreads = do
let runReceiver = frameReceiver ctx conf
runSender = frameSender ctx conf mgr
concurrently_ runReceiver runSender
let runReceiver = frameReceiver ctx conf
runSender = frameSender ctx conf mgr
runBackgroundThreads = concurrently_ runReceiver runSender
exchangeSettings conf ctx
mvar <- newMVar ()
let runClient = do
x <- client $ sendRequest ctx mgr scheme authority
waitCounter0 mgr
let frame = goawayFrame 0 NoError "graceful closing"
mvar <- newMVar ()
enqueueControl (controlQ ctx) $ CGoaway frame mvar
takeMVar mvar
return x
Expand Down
3 changes: 2 additions & 1 deletion Network/HTTP2/Server/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ run conf@Config{..} server = do
replicateM_ 3 $ spawnAction mgr
let runReceiver = frameReceiver ctx conf
runSender = frameSender ctx conf mgr
stopAfter mgr (concurrently_ runReceiver runSender) $ \res -> do
runBackgroundThreads = concurrently_ runReceiver runSender
stopAfter mgr runBackgroundThreads $ \res -> do
closeAllStreams (streamTable ctx) $ either Just (const Nothing) res
case res of
Left err ->
Expand Down

0 comments on commit 73d2360

Please sign in to comment.