diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-30 17:14:26 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-30 17:14:51 -0400 |
commit | 4318f594d544320825093de8661ed1b40e4774d5 (patch) | |
tree | 709dcd2fe739c503651bc7bd5e1df35a52a27977 /Assistant/Threads/Transferrer.hs | |
parent | 07cd1b2b40735d460c8225762fcf3992b9886c60 (diff) |
finished pushing Assistant monad into all relevant files
All temporary and old functions are removed.
Diffstat (limited to 'Assistant/Threads/Transferrer.hs')
-rw-r--r-- | Assistant/Threads/Transferrer.hs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs index c60790f9b..84013eaa7 100644 --- a/Assistant/Threads/Transferrer.hs +++ b/Assistant/Threads/Transferrer.hs @@ -30,26 +30,22 @@ maxTransfers = 1 transfererThread :: NamedThread transfererThread = NamedThread "Transferr" $ do program <- liftIO readProgramFile - transferqueue <- getAssistant transferQueue - dstatus <- getAssistant daemonStatusHandle - starter <- asIO2 $ startTransfer program - forever $ inTransferSlot $ liftIO $ - maybe (return Nothing) (uncurry starter) - =<< getNextTransfer transferqueue dstatus notrunning + forever $ inTransferSlot $ + maybe (return Nothing) (uncurry $ startTransfer program) + =<< getNextTransfer notrunning where {- Skip transfers that are already running. -} notrunning = isNothing . startedTime {- By the time this is called, the daemonstatus's transfer map should - already have been updated to include the transfer. -} -startTransfer :: FilePath -> Transfer -> TransferInfo -> Assistant (Maybe (Transfer, TransferInfo, IO ())) +startTransfer :: FilePath -> Transfer -> TransferInfo -> Assistant (Maybe (Transfer, TransferInfo, Assistant ())) startTransfer program t info = case (transferRemote info, associatedFile info) of (Just remote, Just file) -> ifM (liftAnnex $ shouldTransfer t info) ( do debug [ "Transferring:" , show t ] notifyTransfer - tp <- asIO2 transferprocess - return $ Just (t, info, tp remote file) + return $ Just (t, info, transferprocess remote file) , do debug [ "Skipping unnecessary transfer:" , show t ] void $ removeTransfer t |