};
OutgoingMessage.prototype.flush = function () {
- this.emit("flush");
+ this._onFlush();
};
OutgoingMessage.prototype.finish = function () {
if (!message.finished) break;
- message.emit("sent");
queue.shift();
if (message.closeOnFinish) return true;
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);
};
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();
debug("self flush readyState = " + self.readyState);
if (req == currentRequest) flushMessageQueue(self, [req]);
- });
+ };
requests.push(req);
};