summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-01-28 21:22:59 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-01-28 21:24:45 +0400
commitc13354e339da3849156287b0ad3bb70b9c115632 (patch)
treecdad83c62fdb8b89185a4a9531580196c107b3f5
parent4c78a52a3a0758fe71810689504220c6b6aeea01 (diff)
downloadnode-new-c13354e339da3849156287b0ad3bb70b9c115632.tar.gz
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.
-rw-r--r--lib/child_process.js4
-rw-r--r--lib/net.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index c8198cfa44..1ac2b9169f 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 ad20e70f6d..0b1a81d321 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -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();