(message, handle, cb)
| 568 | |
| 569 | // Shared listen socket. |
| 570 | function shared(message, handle, cb) { |
| 571 | var key = message.key; |
| 572 | // Monkey-patch the close() method so we can keep track of when it's |
| 573 | // closed. Avoids resource leaks when the handle is short-lived. |
| 574 | var close = handle.close; |
| 575 | handle.close = function() { |
| 576 | send({ act: 'close', key: key }); |
| 577 | delete handles[key]; |
| 578 | return close.apply(this, arguments); |
| 579 | }; |
| 580 | assert(handles[key] === undefined); |
| 581 | handles[key] = handle; |
| 582 | cb(message.errno, handle); |
| 583 | } |
| 584 | |
| 585 | // Round-robin. Master distributes handles across workers. |
| 586 | function rr(message, cb) { |
no test coverage detected