|
@ -733,13 +733,11 @@ function httpSocketSetup(socket) { |
|
|
// An array of outgoing messages for the socket. In pipelined connections
|
|
|
// An array of outgoing messages for the socket. In pipelined connections
|
|
|
// we need to keep track of the order they were sent.
|
|
|
// we need to keep track of the order they were sent.
|
|
|
socket._outgoing = []; |
|
|
socket._outgoing = []; |
|
|
socket.__destroyOnDrain = false; |
|
|
|
|
|
|
|
|
|
|
|
// NOTE: be sure not to use ondrain elsewhere in this file!
|
|
|
// NOTE: be sure not to use ondrain elsewhere in this file!
|
|
|
socket.ondrain = function() { |
|
|
socket.ondrain = function() { |
|
|
var message = socket._outgoing[0]; |
|
|
var message = socket._outgoing[0]; |
|
|
if (message) message.emit('drain'); |
|
|
if (message) message.emit('drain'); |
|
|
if (socket.__destroyOnDrain) socket.destroy(); |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -833,18 +831,7 @@ function connectionListener(socket) { |
|
|
if (message._last) { |
|
|
if (message._last) { |
|
|
// No more messages to be pushed out.
|
|
|
// No more messages to be pushed out.
|
|
|
|
|
|
|
|
|
if (!socket._writeQueue) { |
|
|
socket.destroySoon(); |
|
|
// 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(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if (socket._outgoing.length) { |
|
|
} else if (socket._outgoing.length) { |
|
|
// Push out the next message.
|
|
|
// Push out the next message.
|
|
|