diff options
author | Luigi Pinca <luigipinca@gmail.com> | 2017-03-19 20:58:31 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-22 10:26:02 -0700 |
commit | e0a9ad1af244f8756a228a6d087b3a55ee4c0d14 (patch) | |
tree | 051c4f5802e1daa45647def9bfab78709183f0f3 /lib/_http_common.js | |
parent | 4eb194a2b10194f3ac1a4c8914d725aa90da265e (diff) | |
download | node-new-e0a9ad1af244f8756a228a6d087b3a55ee4c0d14.tar.gz |
http: avoid retaining unneeded memory
Prevent the events listeners of the sockets obtained with the HTTP
upgrade mechanism from retaining unneeded memory.
Ref: https://github.com/nodejs/node/issues/11868
PR-URL: https://github.com/nodejs/node/pull/11926
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/_http_common.js')
-rw-r--r-- | lib/_http_common.js | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/_http_common.js b/lib/_http_common.js index 2245ae079a..52cabd87fd 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -26,6 +26,7 @@ const methods = binding.methods; const HTTPParser = binding.HTTPParser; const FreeList = require('internal/freelist').FreeList; +const ondrain = require('internal/http').ondrain; const incoming = require('_http_incoming'); const IncomingMessage = incoming.IncomingMessage; const readStart = incoming.readStart; @@ -222,11 +223,6 @@ function freeParser(parser, req, socket) { } -function ondrain() { - if (this._httpMessage) this._httpMessage.emit('drain'); -} - - function httpSocketSetup(socket) { socket.removeListener('drain', ondrain); socket.on('drain', ondrain); |