diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-03-01 13:01:53 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-03-01 13:11:40 +0100 |
commit | f26362e9381d88d4c906e3624f90fc76e9087c20 (patch) | |
tree | 0472a422e86eaf627c402b57bc968e665c98b072 | |
parent | 50ba0f27d9a14473201c93fab09c2c6cf96c063b (diff) | |
download | node-f26362e9381d88d4c906e3624f90fc76e9087c20.tar.gz |
http: use socket.once, not socket.on
Register the 'close' event listener with .once(), not .on().
It doesn't matter in the grand scheme of things because the listener
doesn't keep references to any heavy-weight objects but using .once()
for a oneshot listener is something of a best practice.
-rw-r--r-- | lib/http.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/http.js b/lib/http.js index 212b8becb..8fddd394a 100644 --- a/lib/http.js +++ b/lib/http.js @@ -515,7 +515,7 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding) { var timer = setTimeout(function() { socket.emit('close'); }); - socket.on('close', function() { + socket.once('close', function() { clearTimeout(timer); }); } |