Skip to content

Commit

Permalink
Make sure connection preface is always sent first
Browse files Browse the repository at this point in the history
This fixes a race condition in the client between the `frameSender`
thread and the main thread, in the case where a SETTINGS frame is sent
in response to a server SETTINGS frame before the connection preface has
had a chance to be sent.
  • Loading branch information
pcapriotti committed Dec 10, 2021
1 parent 8e6ab54 commit b508ea5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Network/HTTP2/Client/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ run ClientConfig{..} conf@Config{..} client = do
clientInfo <- newClientInfo scheme authority cacheLimit
ctx <- newContext clientInfo
mgr <- start confTimeoutManager
exchangeSettings conf ctx
tid0 <- forkIO $ frameReceiver ctx confReadN
-- fixme: if frameSender is terminated but the main thread is alive,
-- what will happen?
tid1 <- forkIO $ frameSender ctx conf mgr
exchangeSettings conf ctx
client (sendRequest ctx scheme authority) `E.finally` do
stop mgr
killThread tid0
Expand Down

0 comments on commit b508ea5

Please sign in to comment.