domain: the EventEmitter constructor is now always called in nodecore
This commit is contained in:
parent
c6185c8484
commit
1e0ce5d1bd
@ -160,6 +160,8 @@ var handleConversion = {
|
||||
|
||||
// This object keep track of the socket there are sended
|
||||
function SocketListSend(slave, key) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.key = key;
|
||||
@ -201,6 +203,8 @@ SocketListSend.prototype.update = function() {
|
||||
|
||||
// This object keep track of the socket there are received
|
||||
function SocketListReceive(slave, key) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.key = key;
|
||||
@ -632,6 +636,8 @@ function maybeClose(subprocess) {
|
||||
|
||||
|
||||
function ChildProcess() {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this._closesNeeded = 1;
|
||||
|
@ -41,7 +41,9 @@ if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {
|
||||
}
|
||||
|
||||
// cluster object:
|
||||
function cluster() {}
|
||||
function cluster() {
|
||||
EventEmitter.call(this);
|
||||
}
|
||||
util.inherits(cluster, EventEmitter);
|
||||
var cluster = module.exports = new cluster();
|
||||
|
||||
@ -254,6 +256,7 @@ function toDecInt(value) {
|
||||
// Create a worker object, that works both for master and worker
|
||||
function Worker(customEnv) {
|
||||
if (!(this instanceof Worker)) return new Worker();
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
var env = process.env;
|
||||
|
@ -811,6 +811,8 @@ function errnoException(errorno, syscall) {
|
||||
|
||||
|
||||
function FSWatcher() {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
var FSEvent = process.binding('fs_event_wrap').FSEvent;
|
||||
this._handle = new FSEvent();
|
||||
@ -869,6 +871,8 @@ fs.watch = function(filename) {
|
||||
// Stat Change Watchers
|
||||
|
||||
function StatWatcher() {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
this._handle = new binding.StatWatcher();
|
||||
|
||||
@ -1564,6 +1568,8 @@ WriteStream.prototype.destroySoon = WriteStream.prototype.end;
|
||||
// SyncWriteStream is internal. DO NOT USE.
|
||||
// Temporary hack for process.stdout and process.stderr when piped to files.
|
||||
function SyncWriteStream(fd) {
|
||||
Stream.call(this);
|
||||
|
||||
this.fd = fd;
|
||||
this.writable = true;
|
||||
this.readable = false;
|
||||
|
14
lib/http.js
14
lib/http.js
@ -21,7 +21,7 @@
|
||||
|
||||
var util = require('util');
|
||||
var net = require('net');
|
||||
var stream = require('stream');
|
||||
var Stream = require('stream');
|
||||
var url = require('url');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var FreeList = require('freelist').FreeList;
|
||||
@ -263,7 +263,7 @@ function utcDate() {
|
||||
|
||||
/* Abstract base class for ServerRequest and ClientResponse. */
|
||||
function IncomingMessage(socket) {
|
||||
stream.Stream.call(this);
|
||||
Stream.call(this);
|
||||
|
||||
// TODO Remove one of these eventually.
|
||||
this.socket = socket;
|
||||
@ -290,7 +290,7 @@ function IncomingMessage(socket) {
|
||||
this.statusCode = null;
|
||||
this.client = this.socket;
|
||||
}
|
||||
util.inherits(IncomingMessage, stream.Stream);
|
||||
util.inherits(IncomingMessage, Stream);
|
||||
|
||||
|
||||
exports.IncomingMessage = IncomingMessage;
|
||||
@ -429,7 +429,7 @@ IncomingMessage.prototype._addHeaderLine = function(field, value) {
|
||||
|
||||
|
||||
function OutgoingMessage() {
|
||||
stream.Stream.call(this);
|
||||
Stream.call(this);
|
||||
|
||||
this.output = [];
|
||||
this.outputEncodings = [];
|
||||
@ -447,7 +447,7 @@ function OutgoingMessage() {
|
||||
|
||||
this.finished = false;
|
||||
}
|
||||
util.inherits(OutgoingMessage, stream.Stream);
|
||||
util.inherits(OutgoingMessage, Stream);
|
||||
|
||||
|
||||
exports.OutgoingMessage = OutgoingMessage;
|
||||
@ -1022,6 +1022,8 @@ ServerResponse.prototype.writeHeader = function() {
|
||||
// concerned with managing a connection pool.
|
||||
|
||||
function Agent(options) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
self.options = options || {};
|
||||
self.requests = {};
|
||||
@ -1791,6 +1793,8 @@ exports._connectionListener = connectionListener;
|
||||
|
||||
function Client(port, host) {
|
||||
if (!(this instanceof Client)) return new Client(port, host);
|
||||
EventEmitter.call(this);
|
||||
|
||||
host = host || 'localhost';
|
||||
port = port || 80;
|
||||
this.host = host;
|
||||
|
@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var events = require('events');
|
||||
var stream = require('stream');
|
||||
var Stream = require('stream');
|
||||
var timers = require('timers');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
@ -129,7 +129,7 @@ function initSocketHandle(self) {
|
||||
function Socket(options) {
|
||||
if (!(this instanceof Socket)) return new Socket(options);
|
||||
|
||||
stream.Stream.call(this);
|
||||
Stream.call(this);
|
||||
|
||||
if (typeof options == 'number') {
|
||||
// Legacy interface.
|
||||
@ -152,7 +152,7 @@ function Socket(options) {
|
||||
this.allowHalfOpen = options && options.allowHalfOpen;
|
||||
}
|
||||
}
|
||||
util.inherits(Socket, stream.Stream);
|
||||
util.inherits(Socket, Stream);
|
||||
|
||||
|
||||
exports.Socket = Socket;
|
||||
|
@ -49,6 +49,8 @@ function Interface(input, output, completer, terminal) {
|
||||
return new Interface(input, output, completer, terminal);
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
|
||||
if (arguments.length === 1) {
|
||||
// an options object was given
|
||||
output = input.output;
|
||||
@ -57,8 +59,6 @@ function Interface(input, output, completer, terminal) {
|
||||
input = input.input;
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
|
||||
completer = completer || function() { return []; };
|
||||
|
||||
if (typeof completer !== 'function') {
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
var util = require('util');
|
||||
var inherits = require('util').inherits;
|
||||
var Stream = require('stream');
|
||||
var vm = require('vm');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
@ -79,6 +80,8 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
|
||||
return new REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined);
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
|
||||
var options, input, output;
|
||||
if (typeof prompt == 'object') {
|
||||
// an options object was given
|
||||
@ -96,8 +99,6 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
self.useGlobal = !!useGlobal;
|
||||
@ -376,6 +377,8 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) {
|
||||
// A stream to push an array into a REPL
|
||||
// used in REPLServer.complete
|
||||
function ArrayStream() {
|
||||
Stream.call(this);
|
||||
|
||||
this.run = function(data) {
|
||||
var self = this;
|
||||
data.forEach(function(line) {
|
||||
@ -383,7 +386,7 @@ function ArrayStream() {
|
||||
});
|
||||
}
|
||||
}
|
||||
util.inherits(ArrayStream, require('stream').Stream);
|
||||
util.inherits(ArrayStream, Stream);
|
||||
ArrayStream.prototype.readable = true;
|
||||
ArrayStream.prototype.writable = true;
|
||||
ArrayStream.prototype.resume = function() {};
|
||||
|
@ -23,7 +23,7 @@ var crypto = require('crypto');
|
||||
var util = require('util');
|
||||
var net = require('net');
|
||||
var events = require('events');
|
||||
var stream = require('stream');
|
||||
var Stream = require('stream');
|
||||
var END_OF_FILE = 42;
|
||||
var assert = require('assert').ok;
|
||||
var constants = require('constants');
|
||||
@ -79,7 +79,7 @@ function convertNPNProtocols(NPNProtocols, out) {
|
||||
|
||||
// Base class of both CleartextStream and EncryptedStream
|
||||
function CryptoStream(pair) {
|
||||
stream.Stream.call(this);
|
||||
Stream.call(this);
|
||||
|
||||
this.pair = pair;
|
||||
|
||||
@ -91,7 +91,7 @@ function CryptoStream(pair) {
|
||||
this._pendingCallbacks = [];
|
||||
this._pendingBytes = 0;
|
||||
}
|
||||
util.inherits(CryptoStream, stream.Stream);
|
||||
util.inherits(CryptoStream, Stream);
|
||||
|
||||
|
||||
CryptoStream.prototype.write = function(data /* , encoding, cb */) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
var binding = process.binding('zlib');
|
||||
var util = require('util');
|
||||
var stream = require('stream');
|
||||
var Stream = require('stream');
|
||||
var assert = require('assert').ok;
|
||||
|
||||
// zlib doesn't provide these, so kludge them in following the same
|
||||
@ -215,6 +215,8 @@ function Unzip(opts) {
|
||||
// you call the .write() method.
|
||||
|
||||
function Zlib(opts, mode) {
|
||||
Stream.call(this);
|
||||
|
||||
this._opts = opts = opts || {};
|
||||
this._queue = [];
|
||||
this._processing = false;
|
||||
@ -296,7 +298,7 @@ function Zlib(opts, mode) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
util.inherits(Zlib, stream.Stream);
|
||||
util.inherits(Zlib, Stream);
|
||||
|
||||
Zlib.prototype.write = function write(chunk, cb) {
|
||||
if (this._hadError) return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user