@@ -1064,26 +1064,27 @@ function listen(self, address, port, addressType, backlog, fd) {
10641064
10651065 cluster . _getServer ( self , address , port , addressType , fd , function ( handle ,
10661066 err ) {
1067- // EACCESS and friends
1068- if ( err ) {
1069- self . emit ( 'error' , errnoException ( err , 'bind' ) ) ;
1070- return ;
1071- }
1072-
1073- // Some operating systems (notably OS X and Solaris) don't report EADDRINUSE
1074- // errors right away. libuv mimics that behavior for the sake of platform
1075- // consistency but that means we have have a socket on our hands that is
1076- // not actually bound. That's why we check if the actual port matches what
1077- // we requested and if not, raise an error. The exception is when port == 0
1078- // because that means "any random port".
1079- if ( port && handle . getsockname && port != handle . getsockname ( ) . port ) {
1080- self . emit ( 'error' , errnoException ( 'EADDRINUSE' , 'bind' ) ) ;
1081- return ;
1082- }
1083-
1084- self . _handle = handle ;
1085- self . _listen2 ( address , port , addressType , backlog , fd ) ;
1086- } ) ;
1067+ // EACCESS and friends
1068+ if ( err ) {
1069+ self . emit ( 'error' , errnoException ( err , 'bind' ) ) ;
1070+ return ;
1071+ }
1072+
1073+ // Some operating systems (notably OS X and Solaris) don't report
1074+ // EADDRINUSE errors right away. libuv mimics that behavior for the
1075+ // sake of platform consistency but that means we have have a socket on
1076+ // our hands that is not actually bound. That's why we check if the
1077+ // actual port matches what we requested and if not, raise an error.
1078+ // The exception is when port == 0 because that means "any random
1079+ // port".
1080+ if ( port && handle . getsockname && port != handle . getsockname ( ) . port ) {
1081+ self . emit ( 'error' , errnoException ( 'EADDRINUSE' , 'bind' ) ) ;
1082+ return ;
1083+ }
1084+
1085+ self . _handle = handle ;
1086+ self . _listen2 ( address , port , addressType , backlog , fd ) ;
1087+ } ) ;
10871088}
10881089
10891090
0 commit comments