remove uint8array check for now. minor style.
This commit is contained in:
parent
8746248c2c
commit
7cae4c4eb5
@ -57,8 +57,6 @@ Parser.prototype.feed = function feed(data) {
|
|||||||
len = utils.copy(this.pending[0], chunk, off);
|
len = utils.copy(this.pending[0], chunk, off);
|
||||||
if (len === this.pending[0].length)
|
if (len === this.pending[0].length)
|
||||||
this.pending.shift();
|
this.pending.shift();
|
||||||
else if (!this.pending[0].slice && this.pending[0] instanceof Uint8Array)
|
|
||||||
this.pending[0] = new Uint8Array(this.pending[0].buffer.slice(len));
|
|
||||||
else
|
else
|
||||||
this.pending[0] = this.pending[0].slice(len);
|
this.pending[0] = this.pending[0].slice(len);
|
||||||
off += len;
|
off += len;
|
||||||
@ -83,8 +81,7 @@ Parser.prototype.parse = function parse(chunk) {
|
|||||||
if (readU32(utils.checksum(this.packet.payload)) !== this.packet.checksum)
|
if (readU32(utils.checksum(this.packet.payload)) !== this.packet.checksum)
|
||||||
return this._error('Invalid checksum');
|
return this._error('Invalid checksum');
|
||||||
|
|
||||||
this.packet.payload = this.parsePayload(this.packet.cmd,
|
this.packet.payload = this.parsePayload(this.packet.cmd, this.packet.payload);
|
||||||
this.packet.payload);
|
|
||||||
if (this.packet.payload)
|
if (this.packet.payload)
|
||||||
this.emit('packet', this.packet);
|
this.emit('packet', this.packet);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user