Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
- get a local reference to the file read stream in case the 'unpipe' …
Browse files Browse the repository at this point in the history
…event nulls out the instance reference during the while loop
  • Loading branch information
stephen-palmer committed Jul 14, 2019
1 parent 845be45 commit ece5b82
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/server/command_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class CommandProcessor extends Duplex {
if(this[kReadStream] === null || this[kSource] === null) return;

let chunk;
while((chunk = this[kReadStream].read()) !== null) {
const rs = this[kReadStream];
while((chunk = rs.read()) !== null) {
this._sendFileQueueChunkReads++;
this._sendFileQueueReadBytes += chunk.length;
if(!this.push(chunk, 'ascii')) break;
Expand Down

0 comments on commit ece5b82

Please sign in to comment.