mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
3511003e66
commit
bcb799f7e3
|
@ -303,7 +303,7 @@ runPeerM s bus p f = do
|
||||||
<*> liftIO (newTVarIO mempty)
|
<*> liftIO (newTVarIO mempty)
|
||||||
|
|
||||||
let de = view envDeferred env
|
let de = view envDeferred env
|
||||||
as <- liftIO $ replicateM 4 $ async $ runPipeline de
|
as <- liftIO $ replicateM 8 $ async $ runPipeline de
|
||||||
|
|
||||||
sw <- liftIO $ async $ forever $ withPeerM env $ do
|
sw <- liftIO $ async $ forever $ withPeerM env $ do
|
||||||
pause defSweepTimeout
|
pause defSweepTimeout
|
||||||
|
|
|
@ -84,7 +84,7 @@ blockChunksProto :: forall e m . ( MonadIO m
|
||||||
|
|
||||||
blockChunksProto adapter (BlockChunks c p) =
|
blockChunksProto adapter (BlockChunks c p) =
|
||||||
case p of
|
case p of
|
||||||
BlockGetAllChunks h size -> deferred proto do
|
BlockGetAllChunks h size -> do
|
||||||
|
|
||||||
me <- ownPeer @e
|
me <- ownPeer @e
|
||||||
who <- thatPeer proto
|
who <- thatPeer proto
|
||||||
|
@ -96,7 +96,7 @@ blockChunksProto adapter (BlockChunks c p) =
|
||||||
let offsets' = calcChunks bsz (fromIntegral size) :: [(Offset, Size)]
|
let offsets' = calcChunks bsz (fromIntegral size) :: [(Offset, Size)]
|
||||||
let offsets = zip offsets' [0..]
|
let offsets = zip offsets' [0..]
|
||||||
|
|
||||||
for_ offsets $ \((o,sz),i) -> do
|
for_ offsets $ \((o,sz),i) -> deferred proto do
|
||||||
chunk <- blkChunk adapter h o sz
|
chunk <- blkChunk adapter h o sz
|
||||||
maybe (pure ()) (response_ . BlockChunk @e i) chunk
|
maybe (pure ()) (response_ . BlockChunk @e i) chunk
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue