From 72549d01de90e7057cd4e27692f4ad4dca385247 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Sun, 26 Feb 2023 18:38:10 +0300 Subject: [PATCH] wip --- hbs2-core/lib/HBS2/Defaults.hs | 2 +- hbs2-peer/app/BlockDownload.hs | 7 ++++--- hbs2-peer/app/DownloadQ.hs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hbs2-core/lib/HBS2/Defaults.hs b/hbs2-core/lib/HBS2/Defaults.hs index 1634c022..31aa459b 100644 --- a/hbs2-core/lib/HBS2/Defaults.hs +++ b/hbs2-core/lib/HBS2/Defaults.hs @@ -42,7 +42,7 @@ defProtoPipelineSize :: Int defProtoPipelineSize = 65536*2 defCookieTimeoutSec :: Timeout 'Seconds -defCookieTimeoutSec = 1200 +defCookieTimeoutSec = 3600 defCookieTimeout :: TimeSpec defCookieTimeout = toTimeSpec defCookieTimeoutSec diff --git a/hbs2-peer/app/BlockDownload.hs b/hbs2-peer/app/BlockDownload.hs index 963788b8..6732b674 100644 --- a/hbs2-peer/app/BlockDownload.hs +++ b/hbs2-peer/app/BlockDownload.hs @@ -533,14 +533,15 @@ postponedLoop env0 = do forever do pause @'Seconds 10 wip1 <- asks (view blockWip) >>= liftIO . Cache.keys + wip2 <- liftIO $ readTVarIO twip - when (wip0 == length wip1) do + when (length wip1 == wip2) do trace "download stuck" for_ wip1 $ \h -> do removeFromWip h addDownload h - wip2 <- asks (view blockWip) >>= liftIO . Cache.keys - liftIO $ atomically $ writeTVar twip (length wip2) + wip3 <- asks (view blockWip) >>= liftIO . Cache.keys + liftIO $ atomically $ writeTVar twip (length wip3) void $ liftIO $ async $ withPeerM e $ withDownload env0 do forever do diff --git a/hbs2-peer/app/DownloadQ.hs b/hbs2-peer/app/DownloadQ.hs index 6f0a9c18..e7e73dde 100644 --- a/hbs2-peer/app/DownloadQ.hs +++ b/hbs2-peer/app/DownloadQ.hs @@ -120,7 +120,7 @@ downloadQueue conf denv = do debug "downloadQueue okay" -- TODO: remove-downloadQueue-pause-hardcode - pause @'Seconds 300 + pause @'Seconds 150 -- FIXME: only-debug-20-sec where