diff options
author | 2012-08-29 15:13:12 -0400 | |
---|---|---|
committer | 2012-08-29 15:13:12 -0400 | |
commit | 9e54355e8b6751f6ce786da480566e27fb5996d8 (patch) | |
tree | 64ce94edc9f268f9a4efac29c882129fb7fbbe84 | |
parent | 93037580b61a17df5e6f849e206cbae0f0116e1b (diff) |
pausing tweaks
-rw-r--r-- | Assistant/WebApp/DashBoard.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs index 849aa9d5f..8b430d4d0 100644 --- a/Assistant/WebApp/DashBoard.hs +++ b/Assistant/WebApp/DashBoard.hs @@ -175,8 +175,9 @@ cancelTransfer pause t = do let dstatus = daemonStatus webapp m <- getCurrentTransfers liftIO $ do - {- remove queued transfer -} - void $ dequeueTransfer (transferQueue webapp) dstatus t + unless pause $ + {- remove queued transfer -} + void $ dequeueTransfer (transferQueue webapp) dstatus t {- stop running transfer -} maybe noop (stop dstatus) (M.lookup t m) where @@ -190,7 +191,8 @@ cancelTransfer pause t = do if pause then void $ alterTransferInfo dstatus t $ info - { transferPaused = True } + { transferPaused = True + , transferPid = Nothing } else void $ removeTransfer dstatus t signalthread tid @@ -202,7 +204,7 @@ cancelTransfer pause t = do killproc pid = do g <- getProcessGroupIDOf pid void $ tryIO $ signalProcessGroup sigTERM g - threadDelay 100000 -- 0.1 second grace period + threadDelay 50000 -- 0.05 second grace period void $ tryIO $ signalProcessGroup sigKILL g startTransfer :: Transfer -> Handler () |