This commit is contained in:
Dmitry Zuikov 2023-02-26 19:47:15 +03:00
parent 72549d01de
commit 98a0ab8db5
2 changed files with 7 additions and 1 deletions

View File

@ -534,6 +534,7 @@ postponedLoop env0 = do
pause @'Seconds 10
wip1 <- asks (view blockWip) >>= liftIO . Cache.keys
wip2 <- liftIO $ readTVarIO twip
trace $ "download stuck chech" <+> pretty wip1 <+> pretty wip2
when (length wip1 == wip2) do
trace "download stuck"

View File

@ -285,7 +285,7 @@ addDownload h = do
notPostponed <- liftIO $ readTVarIO po <&> isNothing . HashMap.lookup h
when (doAdd && notPostponed && notHere) do
if (doAdd && notPostponed && notHere) then do
q <- asks (view downloadQ)
wip <- asks (view blockWip)
@ -296,6 +296,11 @@ addDownload h = do
writeTQueue q h
Cache.insert wip h ()
else do
-- FIXME: wtf?
po <- asks (view peerPostponed)
liftIO $ atomically $ do
modifyTVar po $ HashMap.insert h ()
-- | False -> do -- not hasSize -> do