mirror of https://github.com/voidlizard/hbs2
burst calculation fixed...
... but we need a real conjestion control algorithm on level of Messaging. New Reno or Vegas, whatever.
This commit is contained in:
parent
5eb0cfdcc9
commit
668e2db8a5
|
@ -16,7 +16,7 @@ defBurst :: Integral a => a
|
||||||
defBurst = 4
|
defBurst = 4
|
||||||
|
|
||||||
defBurstMax :: Integral a => a
|
defBurstMax :: Integral a => a
|
||||||
defBurstMax = 256
|
defBurstMax = 128
|
||||||
|
|
||||||
-- defChunkSize :: Integer
|
-- defChunkSize :: Integer
|
||||||
defChunkSize :: Integral a => a
|
defChunkSize :: Integral a => a
|
||||||
|
@ -58,11 +58,11 @@ defBlockInfoTimeout = 2
|
||||||
|
|
||||||
-- how much time wait for block from peer?
|
-- how much time wait for block from peer?
|
||||||
defBlockWaitMax :: Timeout 'Seconds
|
defBlockWaitMax :: Timeout 'Seconds
|
||||||
defBlockWaitMax = 5.0 :: Timeout 'Seconds
|
defBlockWaitMax = 2.5 :: Timeout 'Seconds
|
||||||
|
|
||||||
-- how much time wait for block from peer?
|
-- how much time wait for block from peer?
|
||||||
defChunkWaitMax :: Timeout 'Seconds
|
defChunkWaitMax :: Timeout 'Seconds
|
||||||
defChunkWaitMax = 1.0 :: Timeout 'Seconds
|
defChunkWaitMax = 0.35 :: Timeout 'Seconds
|
||||||
|
|
||||||
defSweepTimeout :: Timeout 'Seconds
|
defSweepTimeout :: Timeout 'Seconds
|
||||||
defSweepTimeout = 30 -- FIXME: only for debug!
|
defSweepTimeout = 30 -- FIXME: only for debug!
|
||||||
|
|
|
@ -320,10 +320,11 @@ downloadFromWithPeer peer thisBkSize h = do
|
||||||
|
|
||||||
else do
|
else do
|
||||||
|
|
||||||
liftIO $ atomically $ modifyTVar (view peerErrors pinfo) succ
|
-- liftIO $ atomically $ modifyTVar (view peerErrors pinfo) succ
|
||||||
updatePeerInfo True pinfo
|
updatePeerInfo True pinfo
|
||||||
|
|
||||||
newBurst <- liftIO $ readTVarIO burstSizeT
|
newBurst' <- liftIO $ readTVarIO burstSizeT
|
||||||
|
let newBurst = floor (realToFrac newBurst' * 0.5 )
|
||||||
|
|
||||||
liftIO $ atomically $ modifyTVar (view peerDownloaded pinfo) (+chunksN)
|
liftIO $ atomically $ modifyTVar (view peerDownloaded pinfo) (+chunksN)
|
||||||
|
|
||||||
|
@ -401,7 +402,7 @@ updatePeerInfo onError pinfo = do
|
||||||
$ if eps == 0 then
|
$ if eps == 0 then
|
||||||
ceiling $ realToFrac bu * 1.10 -- FIXME: to defaults
|
ceiling $ realToFrac bu * 1.10 -- FIXME: to defaults
|
||||||
else
|
else
|
||||||
floor $ realToFrac bu * 0.70
|
floor $ realToFrac bu * 0.55
|
||||||
else
|
else
|
||||||
max defBurst $ floor (realToFrac bu * 0.75)
|
max defBurst $ floor (realToFrac bu * 0.75)
|
||||||
|
|
||||||
|
@ -445,7 +446,7 @@ blockDownloadLoop env0 = do
|
||||||
|
|
||||||
|
|
||||||
void $ liftIO $ async $ forever $ withPeerM e do
|
void $ liftIO $ async $ forever $ withPeerM e do
|
||||||
pause @'Seconds 0.5
|
pause @'Seconds 5
|
||||||
|
|
||||||
pee <- knownPeers @e pl
|
pee <- knownPeers @e pl
|
||||||
npi <- newPeerInfo
|
npi <- newPeerInfo
|
||||||
|
|
Loading…
Reference in New Issue