@@ -299,9 +299,8 @@ Socket.prototype.read = function(n) {
299299
300300Socket . prototype . listen = function ( ) {
301301 debug ( 'socket.listen' ) ;
302- var self = this ;
303- self . on ( 'connection' , arguments [ 0 ] ) ;
304- listen ( self , null , null , null ) ;
302+ this . on ( 'connection' , arguments [ 0 ] ) ;
303+ listen ( this , null , null , null ) ;
305304} ;
306305
307306
@@ -883,7 +882,6 @@ Socket.prototype.connect = function(options, cb) {
883882 this . _sockname = null ;
884883 }
885884
886- var self = this ;
887885 var pipe = ! ! options . path ;
888886 debug ( 'pipe' , pipe , options . path ) ;
889887
@@ -893,21 +891,20 @@ Socket.prototype.connect = function(options, cb) {
893891 }
894892
895893 if ( typeof cb === 'function' ) {
896- self . once ( 'connect' , cb ) ;
894+ this . once ( 'connect' , cb ) ;
897895 }
898896
899897 this . _unrefTimer ( ) ;
900898
901- self . _connecting = true ;
902- self . writable = true ;
899+ this . _connecting = true ;
900+ this . writable = true ;
903901
904902 if ( pipe ) {
905- connect ( self , options . path ) ;
906-
903+ connect ( this , options . path ) ;
907904 } else {
908- lookupAndConnect ( self , options ) ;
905+ lookupAndConnect ( this , options ) ;
909906 }
910- return self ;
907+ return this ;
911908} ;
912909
913910
@@ -1198,11 +1195,10 @@ exports._createServerHandle = createServerHandle;
11981195
11991196Server . prototype . _listen2 = function ( address , port , addressType , backlog , fd ) {
12001197 debug ( 'listen2' , address , port , addressType , backlog , fd ) ;
1201- var self = this ;
12021198
12031199 // If there is not yet a handle, we need to create one and bind.
12041200 // In the case of a server sent via IPC, we don't need to do this.
1205- if ( self . _handle ) {
1201+ if ( this . _handle ) {
12061202 debug ( '_listen2: have a handle already' ) ;
12071203 } else {
12081204 debug ( '_listen2: create a handle' ) ;
@@ -1227,22 +1223,22 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
12271223
12281224 if ( typeof rval === 'number' ) {
12291225 var error = exceptionWithHostPort ( rval , 'listen' , address , port ) ;
1230- process . nextTick ( emitErrorNT , self , error ) ;
1226+ process . nextTick ( emitErrorNT , this , error ) ;
12311227 return ;
12321228 }
1233- self . _handle = rval ;
1229+ this . _handle = rval ;
12341230 }
12351231
1236- self . _handle . onconnection = onconnection ;
1237- self . _handle . owner = self ;
1232+ this . _handle . onconnection = onconnection ;
1233+ this . _handle . owner = this ;
12381234
1239- var err = _listen ( self . _handle , backlog ) ;
1235+ var err = _listen ( this . _handle , backlog ) ;
12401236
12411237 if ( err ) {
12421238 var ex = exceptionWithHostPort ( err , 'listen' , address , port ) ;
1243- self . _handle . close ( ) ;
1244- self . _handle = null ;
1245- process . nextTick ( emitErrorNT , self , ex ) ;
1239+ this . _handle . close ( ) ;
1240+ this . _handle = null ;
1241+ process . nextTick ( emitErrorNT , this , ex ) ;
12461242 return ;
12471243 }
12481244
@@ -1253,7 +1249,7 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
12531249 if ( this . _unref )
12541250 this . unref ( ) ;
12551251
1256- process . nextTick ( emitListeningNT , self ) ;
1252+ process . nextTick ( emitListeningNT , this ) ;
12571253} ;
12581254
12591255
@@ -1522,15 +1518,14 @@ Server.prototype.close = function(cb) {
15221518
15231519Server . prototype . _emitCloseIfDrained = function ( ) {
15241520 debug ( 'SERVER _emitCloseIfDrained' ) ;
1525- var self = this ;
15261521
1527- if ( self . _handle || self . _connections ) {
1522+ if ( this . _handle || this . _connections ) {
15281523 debug ( 'SERVER handle? %j connections? %d' ,
1529- ! ! self . _handle , self . _connections ) ;
1524+ ! ! this . _handle , this . _connections ) ;
15301525 return ;
15311526 }
15321527
1533- process . nextTick ( emitCloseNT , self ) ;
1528+ process . nextTick ( emitCloseNT , this ) ;
15341529} ;
15351530
15361531
0 commit comments