summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-31 11:47:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-31 11:47:35 -0400
commit34aeecb78a40229b0a82638ec93f2feeb15bba27 (patch)
tree7e44edd5079ea4c1818e6cabd224f44babfd1045 /Assistant
parent742eaef0a147ee33626ac0d699bdcd46b8ed7028 (diff)
fix bug where resuming a transfer also started one queued transfer
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/WebApp/DashBoard.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs
index ffe967111..f9fad1bf6 100644
--- a/Assistant/WebApp/DashBoard.hs
+++ b/Assistant/WebApp/DashBoard.hs
@@ -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