send update notificaton when removing a queued transfer
This commit is contained in:
parent
0d80406b2b
commit
21bd92f077
2 changed files with 20 additions and 14 deletions
|
@ -136,9 +136,13 @@ getNextTransfer q dstatus acceptable = atomically $ do
|
|||
|
||||
{- Removes a transfer from the queue, if present, and returns True if it
|
||||
- was present. -}
|
||||
dequeueTransfer :: TransferQueue -> Transfer -> IO Bool
|
||||
dequeueTransfer q t = atomically $ do
|
||||
(l, removed) <- partition (\i -> fst i /= t) <$> readTVar (queuelist q)
|
||||
void $ writeTVar (queuesize q) (length l)
|
||||
void $ writeTVar (queuelist q) l
|
||||
return $ not $ null removed
|
||||
dequeueTransfer :: TransferQueue -> DaemonStatusHandle -> Transfer -> IO Bool
|
||||
dequeueTransfer q dstatus t = do
|
||||
ok <- atomically $ do
|
||||
(l, removed) <- partition (\i -> fst i /= t) <$> readTVar (queuelist q)
|
||||
void $ writeTVar (queuesize q) (length l)
|
||||
void $ writeTVar (queuelist q) l
|
||||
return $ not $ null removed
|
||||
when ok $
|
||||
notifyTransfer dstatus
|
||||
return ok
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue