From e8bc33fe29ca39d230eb4a9fb36ce6d17dbfef24 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 Dec 2013 13:17:22 -0400 Subject: fix deadlock when state TMVar is empty --- Remote/External.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Remote/External.hs') 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. -} -- cgit v1.2.3