Permalink
Browse files

Properly handle holes in children array

  • Loading branch information...
1 parent 50b0c38 commit 7ea8f8a906ffaa97f80ff24273375b502f7d0922 @kriszyp committed Oct 20, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 multi-node.js
View
@@ -66,9 +66,11 @@ exports.listen = function(options, server){
child.master.write("tcp", "ascii", tcpDescriptor);
(function(child){
for(var j = 0; j < i; j++){
- var siblingConnection = netBinding.socketpair();
- child.master.write("sibling", "ascii", siblingConnection[1]);
- children[j].master.write("sibling", "ascii", siblingConnection[0]);
+ if(children[j]){
+ var siblingConnection = netBinding.socketpair();
+ child.master.write("sibling", "ascii", siblingConnection[1]);
+ children[j].master.write("sibling", "ascii", siblingConnection[0]);
+ }
}
var masterChildConnection = netBinding.socketpair();
process.nextTick(function(){

0 comments on commit 7ea8f8a

Please sign in to comment.