fix bug where resuming a transfer also started one queued transfer

This commit is contained in:
Joey Hess 2012-08-31 11:47:35 -04:00
parent 742eaef0a1
commit 34aeecb78a
2 changed files with 7 additions and 11 deletions

View file

@ -209,16 +209,15 @@ cancelTransfer pause t = do
startTransfer :: Transfer -> Handler ()
startTransfer t = do
m <- getCurrentTransfers
webapp <- getYesod
let dstatus = daemonStatus webapp
let q = transferQueue webapp
{- resume a paused transfer -}
maybe noop go (M.lookup t m)
{- start a queued transfer -}
is <- liftIO $ map snd <$> getMatchingTransfers q dstatus (== t)
maybe noop start $ headMaybe is
maybe startqueued go (M.lookup t m)
where
go info = maybe (start info) (resume info) $ transferTid info
startqueued = do
webapp <- getYesod
let dstatus = daemonStatus webapp
let q = transferQueue webapp
is <- liftIO $ map snd <$> getMatchingTransfers q dstatus (== t)
maybe noop start $ headMaybe is
resume info tid = do
webapp <- getYesod
let dstatus = daemonStatus webapp

View file

@ -3,9 +3,6 @@ all the other git clones, at both the git level and the key/value level.
## immediate action items
* There's apparently a race, as sometimes pausing a transfer causes it to start
one of the other queued transfers.
## longer-term TODO
* Test MountWatcher on LXDE.