mirror of https://github.com/voidlizard/hbs2
fix
This commit is contained in:
parent
96deffbf5c
commit
c8109d1c61
|
@ -66,7 +66,7 @@ defBlockWipTimeout :: TimeSpec
|
|||
defBlockWipTimeout = defCookieTimeout
|
||||
|
||||
defBlockInfoTimeout :: Timeout 'Seconds
|
||||
defBlockInfoTimeout = 1
|
||||
defBlockInfoTimeout = 2
|
||||
|
||||
defBlockInfoTimeoutSpec :: TimeSpec
|
||||
defBlockInfoTimeoutSpec = toTimeSpec defBlockInfoTimeout
|
||||
|
|
|
@ -527,9 +527,13 @@ postponedLoop env0 = do
|
|||
|
||||
|
||||
void $ liftIO $ async $ withPeerM e $ withDownload env0 do
|
||||
pause @'Seconds 60
|
||||
ban <- asks (view blockBanned)
|
||||
void $ liftIO $ Cache.purgeExpired ban
|
||||
forever do
|
||||
pause @'Seconds 60
|
||||
ban <- asks (view blockBanned)
|
||||
void $ liftIO $ Cache.purgeExpired ban
|
||||
wip <- asks (view blockWip) >>= liftIO . Cache.keys <&> HashSet.fromList
|
||||
trace $ "wipe banned!"
|
||||
void $ liftIO $ Cache.filterWithKey (\(h,_) _ -> HashSet.member h wip ) ban
|
||||
|
||||
void $ liftIO $ async $ withPeerM e $ withDownload env0 do
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ delFromPostponed h = do
|
|||
liftIO $ atomically $ do
|
||||
modifyTVar' po (HashMap.delete h)
|
||||
|
||||
removeFromWip :: MonadIO m => Hash HbSync -> BlockDownloadM e m ()
|
||||
removeFromWip :: (MyPeer e, MonadIO m) => Hash HbSync -> BlockDownloadM e m ()
|
||||
removeFromWip h = do
|
||||
wip <- asks (view blockWip)
|
||||
st <- asks (view blockState)
|
||||
|
@ -342,8 +342,11 @@ removeFromWip h = do
|
|||
tinq <- asks (view blockInQ)
|
||||
po <- asks (view peerPostponed)
|
||||
wi <- asks (view blocksWipCnt)
|
||||
ba <- asks (view blockBanned)
|
||||
|
||||
liftIO $ Cache.delete wip h
|
||||
liftIO $ Cache.filterWithKey (\(hx,_) _ -> hx /= h) ba
|
||||
|
||||
liftIO $ atomically $ do
|
||||
modifyTVar' st (HashMap.delete h)
|
||||
modifyTVar' sz (HashMap.delete h)
|
||||
|
|
Loading…
Reference in New Issue