Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-01-04 22:22:17 +0300
committerRyan Dahl <ry@tinyclouds.org>2011-01-04 22:22:19 +0300
commit2957382991c6559fa397d0f9a790ee82f5029b37 (patch)
tree51629c2e19c17d3ad54b13bf4ef67fe9cd71bca2 /lib/http.js
parent73f4ec51fde3bfb3e16d6d706aae42656d083c1a (diff)
Implement new stream method, destroySoon
Still missing on fs.WriteStream
Diffstat (limited to 'lib/http.js')
-rw-r--r--lib/http.js15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/http.js b/lib/http.js
index f061effe331..960d28aaa36 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -733,13 +733,11 @@ function httpSocketSetup(socket) {
// An array of outgoing messages for the socket. In pipelined connections
// we need to keep track of the order they were sent.
socket._outgoing = [];
- socket.__destroyOnDrain = false;
// NOTE: be sure not to use ondrain elsewhere in this file!
socket.ondrain = function() {
var message = socket._outgoing[0];
if (message) message.emit('drain');
- if (socket.__destroyOnDrain) socket.destroy();
};
}
@@ -833,18 +831,7 @@ function connectionListener(socket) {
if (message._last) {
// No more messages to be pushed out.
- if (!socket._writeQueue) {
- // Putting this here for https. Really need to add below hack to
- // both socket and https interfaces.
- socket.end();
- } else {
- // HACK: need way to do this with socket interface
- if (socket._writeQueue.length) {
- socket.__destroyOnDrain = true; //socket.end();
- } else {
- socket.destroy();
- }
- }
+ socket.destroySoon();
} else if (socket._outgoing.length) {
// Push out the next message.