diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2013-01-14 21:08:20 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2013-01-18 03:13:41 +0400 |
commit | 4488a69fac9a00ec8ce941464cfc16b9078249ee (patch) | |
tree | a94033d3b7f2ff71e75e879e661ff3ef6398efca /doc/api/child_process.markdown | |
parent | 44cd121c63b7a4d647631f14631485ec725d7cde (diff) | |
download | node-new-4488a69fac9a00ec8ce941464cfc16b9078249ee.tar.gz |
child_process: do not keep list of sent sockets
Keeping list of all sockets that were sent to child process causes memory
leak and thus unacceptable (see #4587). However `server.close()` should
still work properly.
This commit introduces two options:
* child.send(socket, { track: true }) - will send socket and track its status.
You should use it when you want to receive `close` event on sent sockets.
* child.send(socket) - will send socket without tracking it status. This
performs much better, because of smaller number of RTT between master and
child.
With both of these options `server.close()` will wait for all sent
sockets to get closed.
Diffstat (limited to 'doc/api/child_process.markdown')
-rw-r--r-- | doc/api/child_process.markdown | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown index d803cffe9b..343030d53f 100644 --- a/doc/api/child_process.markdown +++ b/doc/api/child_process.markdown @@ -124,10 +124,11 @@ process may not actually kill it. `kill` really just sends a signal to a proces See `kill(2)` -### child.send(message, [sendHandle]) +### child.send(message, [sendHandle], [options]) * `message` {Object} * `sendHandle` {Handle object} +* `options` {Object} When using `child_process.fork()` you can write to the child using `child.send(message, [sendHandle])` and messages are received by @@ -166,6 +167,11 @@ The `sendHandle` option to `child.send()` is for sending a TCP server or socket object to another process. The child will receive the object as its second argument to the `message` event. +The `options` object may have the following properties: + + * `track` - Notify master process when `sendHandle` will be closed in child + process. (`false` by default) + **send server object** Here is an example of sending a server: |