diff options
Diffstat (limited to 'lib/child_process_uv.js')
-rw-r--r-- | lib/child_process_uv.js | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/lib/child_process_uv.js b/lib/child_process_uv.js index 2e6c914178..da712a4d31 100644 --- a/lib/child_process_uv.js +++ b/lib/child_process_uv.js @@ -73,7 +73,7 @@ function setupChannel(target, channel) { var jsonBuffer = ''; - channel.onread = function(pool, offset, length, recvStream) { + channel.onread = function(pool, offset, length, recvHandle) { if (pool) { jsonBuffer += pool.toString('ascii', offset, offset + length); @@ -83,14 +83,7 @@ function setupChannel(target, channel) { var message = JSON.parse(json); jsonBuffer = jsonBuffer.slice(i + 1); - if (recvStream) { - // TODO support other types of stream. - // TODO probably need a queue of recvStreams - var server = new net.Server(); - server._handle = recvStream; - } - - target.emit('message', message, server); + target.emit('message', message, recvHandle); } } else { @@ -99,17 +92,9 @@ function setupChannel(target, channel) { } }; - target.send = function(message, sendStream) { + target.send = function(message, sendHandle) { if (!target._channel) throw new Error("channel closed"); - // Open up net.Server instances - if (sendStream) { - if (false == sendStream instanceof net.Server) { - throw new Error("sendStream must be instance of net.Server"); - } - sendStream = sendStream._handle; - } - // For overflow protection don't write if channel queue is too deep. if (channel.writeQueueSize > 1024 * 1024) { return false; @@ -117,7 +102,7 @@ function setupChannel(target, channel) { var buffer = Buffer(JSON.stringify(message) + '\n'); - var writeReq = channel.write(buffer, 0, buffer.length, sendStream); + var writeReq = channel.write(buffer, 0, buffer.length, sendHandle); if (!writeReq) { throw new Error(errno + " cannot write to IPC channel."); |