Browse Source

child_process: move binding init in constructor

Doing this in net.Socket constructor has much more overhead, and
error is actually may happen before the construction of socket object.
v0.9.9-release
Fedor Indutny 12 years ago
parent
commit
c13354e339
  1. 4
      lib/child_process.js
  2. 4
      lib/net.js

4
lib/child_process.js

@ -668,6 +668,10 @@ function maybeClose(subprocess) {
function ChildProcess() { function ChildProcess() {
EventEmitter.call(this); EventEmitter.call(this);
// Initialize TCPWrap and PipeWrap
process.binding('tcp_wrap');
process.binding('pipe_wrap');
var self = this; var self = this;
this._closesNeeded = 1; this._closesNeeded = 1;

4
lib/net.js

@ -142,10 +142,6 @@ function Socket(options) {
stream.Duplex.call(this, options); stream.Duplex.call(this, options);
if (options.handle) { if (options.handle) {
// Initialize TCPWrap and PipeWrap
process.binding('tcp_wrap');
process.binding('pipe_wrap');
this._handle = options.handle; // private this._handle = options.handle; // private
} else if (typeof options.fd !== 'undefined') { } else if (typeof options.fd !== 'undefined') {
this._handle = createPipe(); this._handle = createPipe();

Loading…
Cancel
Save