|
@ -411,7 +411,7 @@ OutgoingMessage.prototype.write = function (chunk, encoding) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
OutgoingMessage.prototype.flush = function () { |
|
|
OutgoingMessage.prototype.flush = function () { |
|
|
this.emit("flush"); |
|
|
this._onFlush(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
OutgoingMessage.prototype.finish = function () { |
|
|
OutgoingMessage.prototype.finish = function () { |
|
@ -566,7 +566,6 @@ function flushMessageQueue (socket, queue) { |
|
|
|
|
|
|
|
|
if (!message.finished) break; |
|
|
if (!message.finished) break; |
|
|
|
|
|
|
|
|
message.emit("sent"); |
|
|
|
|
|
queue.shift(); |
|
|
queue.shift(); |
|
|
|
|
|
|
|
|
if (message.closeOnFinish) return true; |
|
|
if (message.closeOnFinish) return true; |
|
@ -664,11 +663,11 @@ function connectionListener (socket) { |
|
|
var res = new ServerResponse(req); |
|
|
var res = new ServerResponse(req); |
|
|
|
|
|
|
|
|
res.shouldKeepAlive = shouldKeepAlive; |
|
|
res.shouldKeepAlive = shouldKeepAlive; |
|
|
res.addListener('flush', function () { |
|
|
res._onFlush = function () { |
|
|
if (flushMessageQueue(socket, responses)) { |
|
|
if (flushMessageQueue(socket, responses)) { |
|
|
socket.end(); |
|
|
socket.end(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}; |
|
|
responses.push(res); |
|
|
responses.push(res); |
|
|
|
|
|
|
|
|
self.emit('request', req, res); |
|
|
self.emit('request', req, res); |
|
@ -716,7 +715,7 @@ function Client ( ) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
self._pushRequest = function (req) { |
|
|
self._pushRequest = function (req) { |
|
|
req.addListener("flush", function () { |
|
|
req._onFlush = function () { |
|
|
if (self.readyState == "closed") { |
|
|
if (self.readyState == "closed") { |
|
|
debug("HTTP CLIENT request flush. reconnect. readyState = " + self.readyState); |
|
|
debug("HTTP CLIENT request flush. reconnect. readyState = " + self.readyState); |
|
|
self._reconnect(); |
|
|
self._reconnect(); |
|
@ -725,7 +724,7 @@ function Client ( ) { |
|
|
|
|
|
|
|
|
debug("self flush readyState = " + self.readyState); |
|
|
debug("self flush readyState = " + self.readyState); |
|
|
if (req == currentRequest) flushMessageQueue(self, [req]); |
|
|
if (req == currentRequest) flushMessageQueue(self, [req]); |
|
|
}); |
|
|
}; |
|
|
requests.push(req); |
|
|
requests.push(req); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|