fix deadlock when state TMVar is empty

This commit is contained in:
Joey Hess 2013-12-27 13:17:22 -04:00
parent 3cd8f1bb13
commit fa6f404a5f

View file

@ -266,7 +266,9 @@ fromExternal lck external extractor a =
go (Just st) = run st
go Nothing = do
st <- startExternal $ externalType external
void $ liftIO $ atomically $ swapTMVar v st
void $ liftIO $ atomically $ do
void $ tryReadTMVar v
putTMVar v st
{- Handle initial protocol startup; check the VERSION
- the remote sends. -}