Browse Source

Simplify a few internal HTTP events.

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
29e867aaa0
  1. 11
      lib/http.js

11
lib/http.js

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

Loading…
Cancel
Save