diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-28 15:16:45 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-28 15:16:45 -0400 |
commit | 45503f3ce47c95e5c9a3f15621df02b108d1a1c9 (patch) | |
tree | d153d285b0512b6e7e47c55cf3c048ed8b2d4a45 /Assistant/Threads/Transferrer.hs | |
parent | 3f6f36cd47e636841f7e863e51bec050e95207b8 (diff) |
avoid removing a transfer being made by another process
When another process is running a transfer, if we try to run a dup it'll
fail, and we should not remove the transfer from the transfer display.
Diffstat (limited to 'Assistant/Threads/Transferrer.hs')
-rw-r--r-- | Assistant/Threads/Transferrer.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs index 3dcbb40cd..f2da99261 100644 --- a/Assistant/Threads/Transferrer.hs +++ b/Assistant/Threads/Transferrer.hs @@ -82,7 +82,8 @@ genTransfer t info = case (transferRemote info, associatedFile info) of - so remove the transfer from the list of current - transfers, just in case it didn't stop - in a way that lets the TransferWatcher do its - - usual cleanup. + - usual cleanup. However, first check if something else is + - running the transfer, to avoid removing active transfers. -} go remote file transferrer = ifM (liftIO $ performTransfer transferrer t $ associatedFile info) ( do @@ -95,7 +96,8 @@ genTransfer t info = case (transferRemote info, associatedFile info) of (associatedFile info) (Just remote) void $ recordCommit - , void $ removeTransfer t + , whenM (liftAnnex $ isNothing <$> checkTransfer t) $ + void $ removeTransfer t ) {- Called right before a transfer begins, this is a last chance to avoid |