Skip to content

Commit

Permalink
Merge pull request #567 from earlbread/fix-expected-responses
Browse files Browse the repository at this point in the history
Fix expectedResponses in GetBlocksAsync
  • Loading branch information
earlbread committed Oct 8, 2019
2 parents e7ccac6 + 9f1ac42 commit 9885d6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Libplanet/Net/Swarm.cs
Expand Up @@ -919,11 +919,17 @@ internal async Task SendMessageAsync(BoundPeer peer, Message message)
blockHashes.ToArray();
var request = new GetBlocks(blockHashesAsArray);
int hashCount = blockHashesAsArray.Count();
if (hashCount < 1)
{
yield.Break();
}
IEnumerable<Message> replies = await SendMessageWithReplyAsync(
peer,
request,
BlockRecvTimeout,
(hashCount / request.ChunkSize) + 1,
((hashCount - 1) / request.ChunkSize) + 1,
yieldToken
);
Expand Down

0 comments on commit 9885d6f

Please sign in to comment.