Skip to content

Commit

Permalink
using waitCounter0 when GOAWAY is received
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jul 8, 2024
1 parent fde1a50 commit bba7668
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Network/HTTP2/H2/Receiver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Network.HTTP2.Frame
import Network.HTTP2.H2.Context
import Network.HTTP2.H2.EncodeFrame
import Network.HTTP2.H2.HPACK
import Network.HTTP2.H2.Manager
import Network.HTTP2.H2.Queue
import Network.HTTP2.H2.Settings
import Network.HTTP2.H2.Stream
Expand Down Expand Up @@ -60,6 +61,8 @@ frameReceiver ctx@Context{..} conf@Config{..} = do
yield
loop 0
| otherwise = do
-- If 'confReadN' is timeouted, an exception is thrown
-- to destroy the thread trees.
hd <- confReadN frameHeaderLength
if BS.null hd
then enqueueControl controlQ $ CFinish ConnectionIsClosed
Expand All @@ -68,7 +71,8 @@ frameReceiver ctx@Context{..} conf@Config{..} = do
loop (n + 1)

sendGoaway se
| Just e@ConnectionIsClosed <- E.fromException se =
| Just e@ConnectionIsClosed <- E.fromException se = do
waitCounter0 threadManager
enqueueControl controlQ $ CFinish e
| Just e@(ConnectionErrorIsReceived _ _ _) <- E.fromException se =
enqueueControl controlQ $ CFinish e
Expand Down

0 comments on commit bba7668

Please sign in to comment.