hypercore-protocol
Advanced tools
Comparing version 6.6.4 to 6.7.0
11
index.js
@@ -58,5 +58,7 @@ var stream = require('readable-stream') | ||
this._maybeFinalize = maybeFinalize | ||
this._utp = null | ||
if (opts.timeout !== 0 && opts.timeout !== false) this.setTimeout(opts.timeout || 5000, this._ontimeout) | ||
this.on('finish', this.finalize) | ||
this.on('pipe', this._onpipe) | ||
@@ -71,2 +73,6 @@ function maybeFinalize (err) { | ||
Protocol.prototype._onpipe = function (stream) { | ||
if (typeof stream.setContentSize === 'function') this._utp = stream | ||
} | ||
Protocol.prototype._prefinalize = function () { | ||
@@ -415,2 +421,7 @@ if (!this.emit('prefinalize', this._maybeFinalize)) this.finalize() | ||
if (this._missing > 8388608) return this._tooBig(data.length) | ||
if (this._utp) { | ||
var reallyMissing = this._missing - (data.length - start) | ||
console.log(reallyMissing) | ||
if (reallyMissing > 0 && !this._needsKey) this._utp.setContentSize(reallyMissing) | ||
} | ||
return start | ||
@@ -417,0 +428,0 @@ } |
{ | ||
"name": "hypercore-protocol", | ||
"version": "6.6.4", | ||
"version": "6.7.0", | ||
"description": "Stream that implements the hypercore protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
68087
2047