fix sometimes health percentage is incorrect

This commit is contained in:
MaysWind 2016-07-10 19:39:08 +08:00
parent d3583b302a
commit b23e7afc15

View file

@ -498,14 +498,11 @@
} }
var totalPieces = []; var totalPieces = [];
var currentPieces = getPieceStatus(task.bitfield, task.numPieces);
var maxCompletedPieceCount = 0; var maxCompletedPieceCount = 0;
var maxCompletedPercent = task.completePercent; var maxCompletedPercent = task.completePercent;
for (var i = 0; i < currentPieces.length; i++) { for (var i = 0; i < task.numPieces; i++) {
var count = currentPieces[i] ? 1 : 0; totalPieces.push(0);
totalPieces.push(count);
maxCompletedPieceCount += count;
} }
for (var i = 0; i < peers.length; i++) { for (var i = 0; i < peers.length; i++) {