From 66ce6a659d236ffae7a436555bf13bb839964b1e Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Fri, 20 Oct 2023 21:28:18 +0300 Subject: [PATCH] Revert "faster-download-start" This reverts commit 351ac97d444fe2dbb5a7d081e93cd547ee29ae75. --- hbs2-core/lib/HBS2/Defaults.hs | 4 ++-- hbs2-core/lib/HBS2/Net/Proto/Definition.hs | 6 +++--- hbs2-peer/app/BlockDownload.hs | 5 ++--- hbs2-peer/app/Brains.hs | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hbs2-core/lib/HBS2/Defaults.hs b/hbs2-core/lib/HBS2/Defaults.hs index 12eacf2f..d75fea41 100644 --- a/hbs2-core/lib/HBS2/Defaults.hs +++ b/hbs2-core/lib/HBS2/Defaults.hs @@ -55,7 +55,7 @@ defBlockSizeCacheTime :: TimeSpec defBlockSizeCacheTime = toTimeSpec ( 30 :: Timeout 'Seconds ) defRequestLimitSec :: Timeout 'Seconds -defRequestLimitSec = 10 -- 300 +defRequestLimitSec = 300 defBlockBanTime :: TimeSpec defBlockBanTime = toTimeSpec defBlockBanTimeSec @@ -70,7 +70,7 @@ defBlockWipTimeout :: TimeSpec defBlockWipTimeout = defCookieTimeout defBlockInfoTimeout :: Timeout 'Seconds -defBlockInfoTimeout = 1 +defBlockInfoTimeout = 20 defBlockInfoTimeoutSpec :: TimeSpec defBlockInfoTimeoutSpec = toTimeSpec defBlockInfoTimeout diff --git a/hbs2-core/lib/HBS2/Net/Proto/Definition.hs b/hbs2-core/lib/HBS2/Net/Proto/Definition.hs index 0fa8b3bd..0def4283 100644 --- a/hbs2-core/lib/HBS2/Net/Proto/Definition.hs +++ b/hbs2-core/lib/HBS2/Net/Proto/Definition.hs @@ -72,7 +72,7 @@ instance HasProtocol L4Proto (BlockInfo L4Proto) where -- FIXME: requestMinPeriod-breaks-fast-block-download -- - requestPeriodLim = ReqLimPerMessage 0.5 + requestPeriodLim = ReqLimPerMessage 1 instance HasProtocol L4Proto (BlockChunks L4Proto) where type instance ProtocolId (BlockChunks L4Proto) = 2 @@ -116,7 +116,7 @@ instance HasProtocol L4Proto (RefLogUpdate L4Proto) where encode = serialise -- TODO: find-out-optimal-max-safe-frequency - requestPeriodLim = ReqLimPerMessage 60 + requestPeriodLim = ReqLimPerMessage 600 instance HasProtocol L4Proto (RefLogRequest L4Proto) where type instance ProtocolId (RefLogRequest L4Proto) = 8 @@ -148,7 +148,7 @@ instance HasProtocol L4Proto (EncryptionHandshake L4Proto) where decode = deserialiseCustom encode = serialise - requestPeriodLim = ReqLimPerProto 0.1 + requestPeriodLim = ReqLimPerProto 0.5 instance HasProtocol L4Proto (RefChanUpdate L4Proto) where diff --git a/hbs2-peer/app/BlockDownload.hs b/hbs2-peer/app/BlockDownload.hs index afaa3d30..974036e1 100644 --- a/hbs2-peer/app/BlockDownload.hs +++ b/hbs2-peer/app/BlockDownload.hs @@ -514,7 +514,6 @@ blockDownloadLoop env0 = do wipNum <- asks (view blockInQ) >>= liftIO . readTVarIO <&> HashMap.size when (wipNum == 0) do - trace "NOTHING TO DOWNLOAD" pause @'Seconds 1 next @@ -528,7 +527,7 @@ blockDownloadLoop env0 = do pure $ not busy when (List.null pips) do - void $ liftIO $ race (pause @'Seconds 1) $ do + void $ liftIO $ race (pause @'Seconds 5) $ do trace "ALL PEERS BUSY" void $ liftIO $ atomically $ do p <- readTQueue released @@ -570,7 +569,7 @@ blockDownloadLoop env0 = do liftIO $ atomically $ modifyTVar downMiss succ Right (Just size) -> do - trace $ "BLOCK SIZE" <+> pretty p <+> pretty h <+> pretty size + -- trace $ "BLOCK SIZE" <+> pretty p <+> pretty h <+> pretty size let downFail = view peerDownloadFail pinfo let downBlk = view peerDownloadedBlk pinfo diff --git a/hbs2-peer/app/Brains.hs b/hbs2-peer/app/Brains.hs index 0317d5de..55e51551 100644 --- a/hbs2-peer/app/Brains.hs +++ b/hbs2-peer/app/Brains.hs @@ -112,6 +112,7 @@ instance ( Hashable (Peer e) updateOP br (deleteDownload br what) onKnownPeers br ps = do + trace $ "BRAINS: onKnownPeers" <+> pretty ps let tv = view brainsPeers br liftIO $ atomically $ writeTVar tv ps updateOP br $ do