summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/child_process.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index eec031333..e93e5d47c 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -111,6 +111,9 @@ var handleConversion = {
'net.Socket': {
send: function(message, socket) {
+ if (!socket._handle)
+ return;
+
// if the socket was created by net.Server
if (socket.server) {
// the slave should keep track of the socket
@@ -139,7 +142,8 @@ var handleConversion = {
postSend: function(handle) {
// Close the Socket handle after sending it
- handle.close();
+ if (handle)
+ handle.close();
},
got: function(message, handle, emit) {
@@ -438,6 +442,11 @@ function setupChannel(target, channel) {
// convert TCP object to native handle object
handle = handleConversion[message.type].send.apply(target, arguments);
+ // If handle was sent twice, or it is impossible to get native handle
+ // out of it - just send a text without the handle.
+ if (!handle)
+ message = message.msg;
+
// Update simultaneous accepts on Windows
if (obj.simultaneousAccepts) {
net._setSimultaneousAccepts(handle);