Skip to content

Commit

Permalink
[core] Ensure that the non-null peersInvolved is used
Browse files Browse the repository at this point in the history
This is cached because we know the version passed into
the method is not guaranteed to be non-null.

However, we do have a guarantee that it will be non-null
when the final block for a given piece is received, so
by the time all blocks are written to disk we will have
a non null entry in the cache.
  • Loading branch information
alanmcgovern committed Feb 18, 2021
1 parent 59d0208 commit d532927
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/MonoTorrent/MonoTorrent.Client/Modes/Mode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ async void WritePieceAsync (PieceMessage message, IList<IPeer> peersInvolved)

// All blocks have been written for this piece have been written!
BlocksWrittenPerPiece.Remove (message.PieceIndex);
peersInvolved = data.peersInvolved;

// Hashcheck the piece as we now have all the blocks.
byte[] hash;
Expand Down

0 comments on commit d532927

Please sign in to comment.