mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
72549d01de
commit
98a0ab8db5
|
@ -534,6 +534,7 @@ postponedLoop env0 = do
|
||||||
pause @'Seconds 10
|
pause @'Seconds 10
|
||||||
wip1 <- asks (view blockWip) >>= liftIO . Cache.keys
|
wip1 <- asks (view blockWip) >>= liftIO . Cache.keys
|
||||||
wip2 <- liftIO $ readTVarIO twip
|
wip2 <- liftIO $ readTVarIO twip
|
||||||
|
trace $ "download stuck chech" <+> pretty wip1 <+> pretty wip2
|
||||||
|
|
||||||
when (length wip1 == wip2) do
|
when (length wip1 == wip2) do
|
||||||
trace "download stuck"
|
trace "download stuck"
|
||||||
|
|
|
@ -285,7 +285,7 @@ addDownload h = do
|
||||||
|
|
||||||
notPostponed <- liftIO $ readTVarIO po <&> isNothing . HashMap.lookup h
|
notPostponed <- liftIO $ readTVarIO po <&> isNothing . HashMap.lookup h
|
||||||
|
|
||||||
when (doAdd && notPostponed && notHere) do
|
if (doAdd && notPostponed && notHere) then do
|
||||||
|
|
||||||
q <- asks (view downloadQ)
|
q <- asks (view downloadQ)
|
||||||
wip <- asks (view blockWip)
|
wip <- asks (view blockWip)
|
||||||
|
@ -296,6 +296,11 @@ addDownload h = do
|
||||||
writeTQueue q h
|
writeTQueue q h
|
||||||
|
|
||||||
Cache.insert wip 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
|
-- | False -> do -- not hasSize -> do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue