| | 86 | _finish: function() { |
|---|
| | 87 | this.download.partialSize = this.download.totalSize; |
|---|
| | 88 | this.download.invalidate(); |
|---|
| | 89 | |
|---|
| | 90 | this.hash = hexdigest(this.hash.finish(false)); |
|---|
| | 91 | if (this.hash != this.download.hash.sum) { |
|---|
| | 92 | Debug.dump("hash mismatch, actual: " + this.hash + " expected: " + this.download.hash.sum); |
|---|
| | 93 | var act = DTA_confirm(_('verifyerrortitle'), _('verifyerrortext'), _('retry'), _('delete'), _('keep')); |
|---|
| | 94 | switch (act) { |
|---|
| | 95 | case 0: this._delete(); this.download.safeRetry(); return; |
|---|
| | 96 | case 1: this._delete(); this.download.cancel(); return; |
|---|
| | 97 | } |
|---|
| | 98 | } |
|---|
| | 99 | this.download.complete(); |
|---|
| | 100 | }, |
|---|
| | 101 | _readNextChunk: function() { |
|---|
| | 102 | if (this._pending <= 0) { |
|---|
| | 103 | this.stream.close(); |
|---|
| | 104 | this._timer.kill(); |
|---|
| | 105 | var thisp = this; |
|---|
| | 106 | setTimeout(function() { thisp._finish(); }, 100); |
|---|
| | 107 | return; |
|---|
| | 108 | } |
|---|
| | 109 | var nextChunk = Math.min(this._pending, 1024 /* 2GB */); |
|---|
| | 110 | this._pending -= nextChunk; |
|---|
| | 111 | new InputStreamPump(this.stream, -1, nextChunk, 0, 0, false).asyncRead(this, null); |
|---|
| | 112 | }, |
|---|
| 96 | | this._timer.kill(); |
|---|
| 97 | | |
|---|
| 98 | | this.download.partialSize = this.download.totalSize; |
|---|
| 99 | | this.download.invalidate(); |
|---|
| 100 | | |
|---|
| 101 | | this.hash = hexdigest(this.hash.finish(false)); |
|---|
| 102 | | if (this.hash != this.download.hash.sum) { |
|---|
| 103 | | var act = DTA_confirm(_('verifyerrortitle'), _('verifyerrortext'), _('retry'), _('delete'), _('keep')); |
|---|
| 104 | | switch (act) { |
|---|
| 105 | | case 0: this._delete(); this.download.retry(); return; |
|---|
| 106 | | case 1: this._delete(); this.download.cancel(); return; |
|---|
| 107 | | } |
|---|
| 108 | | } |
|---|
| 109 | | this.download.complete(); |
|---|
| | 125 | this._readNextChunk(); |
|---|