diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-30 15:39:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-30 15:39:15 -0400 |
commit | 07cd1b2b40735d460c8225762fcf3992b9886c60 (patch) | |
tree | c08c38417dfd9cba94ac56e212fa9d5864927ac0 /Assistant/Threads/Transferrer.hs | |
parent | bab7e83221468905b76e28bb123ebe26e146b97b (diff) |
pushed Assistant monad down into DaemonStatus code
Currently have three old versions of functions that more reworking is
needed to remove: getDaemonStatusOld, modifyDaemonStatusOld_, and
modifyDaemonStatusOld
Diffstat (limited to 'Assistant/Threads/Transferrer.hs')
-rw-r--r-- | Assistant/Threads/Transferrer.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs index 6bcb05e0e..c60790f9b 100644 --- a/Assistant/Threads/Transferrer.hs +++ b/Assistant/Threads/Transferrer.hs @@ -32,9 +32,8 @@ transfererThread = NamedThread "Transferr" $ do program <- liftIO readProgramFile transferqueue <- getAssistant transferQueue dstatus <- getAssistant daemonStatusHandle - slots <- getAssistant transferSlots starter <- asIO2 $ startTransfer program - liftIO $ forever $ inTransferSlot dstatus slots $ + forever $ inTransferSlot $ liftIO $ maybe (return Nothing) (uncurry starter) =<< getNextTransfer transferqueue dstatus notrunning where @@ -48,12 +47,12 @@ startTransfer program t info = case (transferRemote info, associatedFile info) o (Just remote, Just file) -> ifM (liftAnnex $ shouldTransfer t info) ( do debug [ "Transferring:" , show t ] - notifyTransfer <<~ daemonStatusHandle + notifyTransfer tp <- asIO2 transferprocess return $ Just (t, info, tp remote file) , do debug [ "Skipping unnecessary transfer:" , show t ] - void $ flip removeTransfer t <<~ daemonStatusHandle + void $ removeTransfer t return Nothing ) _ -> return Nothing @@ -77,10 +76,8 @@ startTransfer program t info = case (transferRemote info, associatedFile info) o - in the transfer. -} whenM (liftIO $ (==) ExitSuccess <$> waitForProcess pid) $ do - dstatus <- getAssistant daemonStatusHandle - liftIO $ void $ addAlert dstatus $ - makeAlertFiller True $ - transferFileAlert direction True file + void $ addAlert $ makeAlertFiller True $ + transferFileAlert direction True file recordCommit where params = |