Comment about http 'finish' and (unused) 'prefinish' events.

This commit is contained in:
Ben Newman
2016-05-07 13:03:39 -04:00
parent 8e8303d76f
commit 6fac3d2ec7

View File

@@ -218,8 +218,10 @@ WebApp._timeoutAdjustmentRequestCallback = function (req, res) {
// Insert our new finish listener to run BEFORE the existing one which removes
// the response from the socket.
var finishListeners = res.listeners('finish');
// XXX Apparently in Node 0.12 this event is now called 'prefinish'.
// XXX Apparently in Node 0.12 this event was called 'prefinish'.
// https://github.com/joyent/node/commit/7c9b6070
// But it has switched back to 'finish' in Node v4:
// https://github.com/nodejs/node/pull/1411
res.removeAllListeners('finish');
res.on('finish', function () {
res.setTimeout(SHORT_SOCKET_TIMEOUT);