diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-12 18:05:45 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-12 18:13:37 -0400 |
commit | 6b074fb7e741020b81d696bd66e62f75fd472966 (patch) | |
tree | 284ac39d6ce641c255555e504c89a9f4d9956744 /Logs | |
parent | 549f635c6b64006b5a369795805d08b8f439d54c (diff) |
convert from Utility.LockPool to Annex.LockPool everywhere
Diffstat (limited to 'Logs')
-rw-r--r-- | Logs/Transfer.hs | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index af6d19da6..43d097354 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -17,7 +17,7 @@ import Utility.Metered import Utility.Percentage import Utility.QuickCheck import Utility.PID -import Utility.LockPool +import Annex.LockPool import Logs.TimeStamp import Data.Time.Clock @@ -136,25 +136,24 @@ checkTransfer t = do void $ tryIO $ removeFile tfile void $ tryIO $ removeFile $ transferLockFile tfile #ifndef mingw32_HOST_OS - liftIO $ do - let lck = transferLockFile tfile - v <- getLockStatus lck - case v of - StatusLockedBy pid -> catchDefaultIO Nothing $ - readTransferInfoFile (Just pid) tfile - StatusNoLockFile -> return Nothing - StatusUnLocked -> do - -- Take a non-blocking lock while deleting - -- the stale lock file. Ignore failure - -- due to permissions problems, races, etc. - void $ tryIO $ do - r <- tryLockExclusive Nothing lck - case r of - Just lockhandle -> do - cleanstale - dropLock lockhandle - _ -> noop - return Nothing + let lck = transferLockFile tfile + v <- getLockStatus lck + case v of + StatusLockedBy pid -> liftIO $ catchDefaultIO Nothing $ + readTransferInfoFile (Just pid) tfile + StatusNoLockFile -> return Nothing + StatusUnLocked -> do + -- Take a non-blocking lock while deleting + -- the stale lock file. Ignore failure + -- due to permissions problems, races, etc. + void $ tryIO $ do + r <- tryLockExclusive Nothing lck + case r of + Just lockhandle -> liftIO $ do + cleanstale + dropLock lockhandle + _ -> noop + return Nothing #else v <- liftIO $ lockShared $ transferLockFile tfile liftIO $ case v of |