when canceling a transfer, also cancel all other downloads of the same key
This commit is contained in:
parent
9e54355e8b
commit
99525f8454
3 changed files with 14 additions and 7 deletions
|
@ -140,12 +140,13 @@ getNextTransfer q dstatus acceptable = atomically $ do
|
|||
return $ Just r
|
||||
else return Nothing
|
||||
|
||||
{- Removes a transfer from the queue, if present, and returns True if it
|
||||
- was present. -}
|
||||
{- Removes a transfer (as well as any equivilant transfers) from the queue,
|
||||
- and returns True if anything was 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)
|
||||
(removed, l) <- partition (equivilantTransfer t . fst)
|
||||
<$> readTVar (queuelist q)
|
||||
void $ writeTVar (queuesize q) (length l)
|
||||
void $ writeTVar (queuelist q) l
|
||||
return $ not $ null removed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue