Skip to content

Commit

Permalink
Reorg lines
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Jan 2, 2016
1 parent e724897 commit d34f0de
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/transmit.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ internals.transmit = function (response, callback) {

request.raw.res.writeHead(response.statusCode);

// Generate tap stream

const tap = response._tap();

// Write payload

let hasEnded = false;
Expand Down Expand Up @@ -324,19 +320,19 @@ internals.transmit = function (response, callback) {
}

request._log(tags, err);
callback();
return callback();
};

source.once('error', end);

const onAborted = () => {

end(null, 'aborted');
return end(null, 'aborted');
};

const onClose = () => {

end(null, 'close');
return end(null, 'close');
};

request.raw.req.once('aborted', onAborted);
Expand All @@ -346,6 +342,7 @@ internals.transmit = function (response, callback) {
request.raw.res.once('error', end);
request.raw.res.once('finish', end);

const tap = response._tap();
const preview = (tap ? source.pipe(tap) : source);
const compressed = (compressor ? preview.pipe(compressor) : preview);
const ranged = (ranger ? compressed.pipe(ranger) : compressed);
Expand Down

0 comments on commit d34f0de

Please sign in to comment.