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.
This commit is contained in:
parent
4c78a52a3a
commit
c13354e339
@ -668,6 +668,10 @@ function maybeClose(subprocess) {
|
||||
function ChildProcess() {
|
||||
EventEmitter.call(this);
|
||||
|
||||
// Initialize TCPWrap and PipeWrap
|
||||
process.binding('tcp_wrap');
|
||||
process.binding('pipe_wrap');
|
||||
|
||||
var self = this;
|
||||
|
||||
this._closesNeeded = 1;
|
||||
|
@ -142,10 +142,6 @@ function Socket(options) {
|
||||
stream.Duplex.call(this, options);
|
||||
|
||||
if (options.handle) {
|
||||
// Initialize TCPWrap and PipeWrap
|
||||
process.binding('tcp_wrap');
|
||||
process.binding('pipe_wrap');
|
||||
|
||||
this._handle = options.handle; // private
|
||||
} else if (typeof options.fd !== 'undefined') {
|
||||
this._handle = createPipe();
|
||||
|
Loading…
x
Reference in New Issue
Block a user