forgot to update the tchan when dequeuing transfers
This commit is contained in:
parent
a4fa31ffa1
commit
0842e99637
1 changed files with 7 additions and 3 deletions
|
@ -145,11 +145,15 @@ getNextTransfer q dstatus acceptable = atomically $ do
|
|||
dequeueTransfer :: TransferQueue -> DaemonStatusHandle -> Transfer -> IO Bool
|
||||
dequeueTransfer q dstatus t = do
|
||||
ok <- atomically $ do
|
||||
(removed, l) <- partition (equivilantTransfer t . fst)
|
||||
(removed, ls) <- partition (equivilantTransfer t . fst)
|
||||
<$> readTVar (queuelist q)
|
||||
void $ writeTVar (queuesize q) (length l)
|
||||
void $ writeTVar (queuelist q) l
|
||||
void $ writeTVar (queuesize q) (length ls)
|
||||
void $ writeTVar (queuelist q) ls
|
||||
drain
|
||||
forM_ ls $ unGetTChan (queue q)
|
||||
return $ not $ null removed
|
||||
when ok $
|
||||
notifyTransfer dstatus
|
||||
return ok
|
||||
where
|
||||
drain = maybe noop (const drain) =<< tryReadTChan (queue q)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue