Skip to content

Commit 5844051

Browse files
committed
update hash validator
1 parent e39fd43 commit 5844051

6 files changed

+13
-11
lines changed

dist/pear-downloader.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -22726,7 +22726,7 @@ module.exports = function zeroFill (width, number, pad) {
2272622726

2272722727
},{}],161:[function(require,module,exports){
2272822728
module.exports={
22729-
"version": "1.2.9"
22729+
"version": "1.2.10"
2273022730
}
2273122731
},{}],162:[function(require,module,exports){
2273222732
(function (process){
@@ -23205,7 +23205,7 @@ Dispatcher.prototype._setupHttp = function (hd) {
2320523205

2320623206
//校验哈希值
2320723207
if (self.validator && !self.validator.validate(buffer, index)) {
23208-
hd.emit('error');
23208+
// hd.emit('error');
2320923209
return;
2321023210
}
2321123211

@@ -25139,7 +25139,7 @@ Torrent.prototype._verifyPieces = function () {
2513925139
if (self.destroyed) return cb(new Error('torrent is destroyed'))
2514025140

2514125141
if (err) return process.nextTick(cb, null) // ignore error
25142-
25142+
2514325143
var hexHash = Rusha.createHash().update(buf).digest('hex')
2514425144
if (self.destroyed) return cb(new Error('torrent is destroyed'))
2514525145

@@ -26078,7 +26078,7 @@ Torrent.prototype._request = function (wire, index, hotswap) {
2607826078

2607926079
var buf = piece.flush()
2608026080

26081-
var hexHash = Rusha.createHash().update(buf).digest('hex');
26081+
var hexHash = Rusha.createHash().update(buf).digest('hex');
2608226082
if (self.destroyed) return
2608326083

2608426084
if (hexHash === self._hashes[index]) {
@@ -28495,7 +28495,8 @@ Worker.prototype._startPlaying = function (nodes) {
2849528495

2849628496
var d = new Dispatcher(self.dispatcherConfig);
2849728497
self.dispatcher = d;
28498-
28498+
d.validator = self.validator;
28499+
2849928500
while (self.tempDCQueue.length) {
2850028501
var jd = self.tempDCQueue.shift();
2850128502
self.dispatcher.addDataChannel(jd);

dist/pear-downloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "peardownloader",
3-
"version": "1.2.9",
3+
"version": "1.2.10",
44
"description": "",
55
"main": "./dist/pear-downloader.js",
66
"dependencies": {

src/dispatcher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Dispatcher.prototype._setupHttp = function (hd) {
473473

474474
//校验哈希值
475475
if (self.validator && !self.validator.validate(buffer, index)) {
476-
hd.emit('error');
476+
// hd.emit('error');
477477
return;
478478
}
479479

src/lib/torrent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ Torrent.prototype._verifyPieces = function () {
593593
if (self.destroyed) return cb(new Error('torrent is destroyed'))
594594

595595
if (err) return process.nextTick(cb, null) // ignore error
596-
596+
597597
var hexHash = Rusha.createHash().update(buf).digest('hex')
598598
if (self.destroyed) return cb(new Error('torrent is destroyed'))
599599

@@ -1532,7 +1532,7 @@ Torrent.prototype._request = function (wire, index, hotswap) {
15321532

15331533
var buf = piece.flush()
15341534

1535-
var hexHash = Rusha.createHash().update(buf).digest('hex');
1535+
var hexHash = Rusha.createHash().update(buf).digest('hex');
15361536
if (self.destroyed) return
15371537

15381538
if (hexHash === self._hashes[index]) {

src/worker.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ Worker.prototype._startPlaying = function (nodes) {
500500

501501
var d = new Dispatcher(self.dispatcherConfig);
502502
self.dispatcher = d;
503-
503+
d.validator = self.validator;
504+
504505
while (self.tempDCQueue.length) {
505506
var jd = self.tempDCQueue.shift();
506507
self.dispatcher.addDataChannel(jd);

0 commit comments

Comments
 (0)