summaryrefslogtreecommitdiff
path: root/Remote/External.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-27 13:17:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-27 13:17:22 -0400
commite8bc33fe29ca39d230eb4a9fb36ce6d17dbfef24 (patch)
treecc7bf9af4b515f2272b2bfc4c73bb7d1be9fb05a /Remote/External.hs
parent46f1ef99195adfb7c370615cfcaeee40cd6eae85 (diff)
fix deadlock when state TMVar is empty
Diffstat (limited to 'Remote/External.hs')
-rw-r--r--Remote/External.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index b8a964480..250719641 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -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. -}