Skip to content

Commit

Permalink
Simplify a few internal HTTP events.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 26, 2010
1 parent 311a62d commit 29e867a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ OutgoingMessage.prototype.write = function (chunk, encoding) {
};

OutgoingMessage.prototype.flush = function () {
this.emit("flush");
this._onFlush();
};

OutgoingMessage.prototype.finish = function () {
Expand Down Expand Up @@ -566,7 +566,6 @@ function flushMessageQueue (socket, queue) {

if (!message.finished) break;

message.emit("sent");
queue.shift();

if (message.closeOnFinish) return true;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -725,7 +724,7 @@ function Client ( ) {

debug("self flush readyState = " + self.readyState);
if (req == currentRequest) flushMessageQueue(self, [req]);
});
};
requests.push(req);
};

Expand Down

0 comments on commit 29e867a

Please sign in to comment.