-
-
Save indutny/ac8b471e51ae80069fda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 0d254b3f368c06dbb7453b1f40d3c01d8034b825 | |
Author: Fedor Indutny <fedor.indutny@gmail.com> | |
Date: Mon Jan 28 21:22:59 2013 +0400 | |
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. | |
diff --git a/lib/child_process.js b/lib/child_process.js | |
index c8198cf..1ac2b91 100644 | |
--- a/lib/child_process.js | |
+++ b/lib/child_process.js | |
@@ -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; | |
diff --git a/lib/net.js b/lib/net.js | |
index 966e4ce..b7c7f06 100644 | |
--- a/lib/net.js | |
+++ b/lib/net.js | |
@@ -139,10 +139,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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment