summaryrefslogtreecommitdiff
path: root/lib/child_process.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/child_process.js')
-rw-r--r--lib/child_process.js32
1 files changed, 23 insertions, 9 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index 1ac2b9169f..ef8c800926 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -155,6 +155,18 @@ var handleConversion = {
emit(socket);
}
+ },
+
+ 'dgram.Native': {
+ simultaneousAccepts: false,
+
+ send: function(message, handle) {
+ return handle;
+ },
+
+ got: function(message, handle, emit) {
+ emit(handle);
+ }
}
};
@@ -355,18 +367,20 @@ function setupChannel(target, channel) {
// this message will be handled by an internalMessage event handler
message = {
cmd: 'NODE_HANDLE',
- type: 'net.',
msg: message
};
- switch (handle.constructor.name) {
- case 'Socket':
- message.type += 'Socket'; break;
- case 'Server':
- message.type += 'Server'; break;
- case 'Pipe':
- case 'TCP':
- message.type += 'Native'; break;
+ if (handle instanceof net.Socket) {
+ message.type = 'net.Socket';
+ } else if (handle instanceof net.Server) {
+ message.type = 'net.Server';
+ } else if (handle instanceof process.binding('tcp_wrap').TCP ||
+ handle instanceof process.binding('pipe_wrap').Pipe) {
+ message.type = 'net.Native';
+ } else if (handle instanceof process.binding('udp_wrap').UDP) {
+ message.type = 'dgram.Native';
+ } else {
+ throw new TypeError("This handle type can't be sent");
}
var obj = handleConversion[message.type];