Fix reading indeterminate-length packets in IE11

Broken in 5dcaf85.
This commit is contained in:
Daniel Huigens 2019-02-25 04:30:09 +01:00
parent cd6eadd6e0
commit a291a803fb

View File

@ -244,7 +244,7 @@ export default {
if (packet_length === Infinity) break;
throw new Error('Unexpected end of packet');
}
const chunk = value.subarray(0, packet_length - bytesRead);
const chunk = packet_length === Infinity ? value : value.subarray(0, packet_length - bytesRead);
if (writer) await writer.write(chunk);
else packet.push(chunk);
bytesRead += value.length;