@@ -79,15 +79,15 @@ const RECV_BUFFER = true;
79
79
const SEND_BUFFER = false ;
80
80
81
81
// Lazily loaded
82
- var cluster = null ;
82
+ let cluster = null ;
83
83
84
84
const errnoException = errors . errnoException ;
85
85
const exceptionWithHostPort = errors . exceptionWithHostPort ;
86
86
87
87
88
88
function Socket ( type , listener ) {
89
89
EventEmitter . call ( this ) ;
90
- var lookup ;
90
+ let lookup ;
91
91
let recvBufferSize ;
92
92
let sendBufferSize ;
93
93
@@ -262,8 +262,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
262
262
return this ;
263
263
}
264
264
265
- var address ;
266
- var exclusive ;
265
+ let address ;
266
+ let exclusive ;
267
267
268
268
if ( port !== null && typeof port === 'object' ) {
269
269
address = port . address || '' ;
@@ -293,7 +293,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
293
293
if ( ! cluster )
294
294
cluster = require ( 'cluster' ) ;
295
295
296
- var flags = 0 ;
296
+ let flags = 0 ;
297
297
if ( state . reuseAddr )
298
298
flags |= UV_UDP_REUSEADDR ;
299
299
if ( state . ipv6Only )
@@ -318,7 +318,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
318
318
319
319
const err = state . handle . bind ( ip , port || 0 , flags ) ;
320
320
if ( err ) {
321
- var ex = exceptionWithHostPort ( err , 'bind' , ip , port ) ;
321
+ const ex = exceptionWithHostPort ( err , 'bind' , ip , port ) ;
322
322
this . emit ( 'error' , ex ) ;
323
323
state . bindState = BIND_STATE_UNBOUND ;
324
324
// Todo: close?
@@ -467,8 +467,8 @@ function sliceBuffer(buffer, offset, length) {
467
467
function fixBufferList ( list ) {
468
468
const newlist = new Array ( list . length ) ;
469
469
470
- for ( var i = 0 , l = list . length ; i < l ; i ++ ) {
471
- var buf = list [ i ] ;
470
+ for ( let i = 0 , l = list . length ; i < l ; i ++ ) {
471
+ const buf = list [ i ] ;
472
472
if ( typeof buf === 'string' )
473
473
newlist [ i ] = Buffer . from ( buf ) ;
474
474
else if ( ! isUint8Array ( buf ) )
@@ -514,7 +514,7 @@ function clearQueue() {
514
514
state . queue = undefined ;
515
515
516
516
// Flush the send queue.
517
- for ( var i = 0 ; i < queue . length ; i ++ )
517
+ for ( let i = 0 ; i < queue . length ; i ++ )
518
518
queue [ i ] ( ) ;
519
519
}
520
520
@@ -732,8 +732,8 @@ Socket.prototype.remoteAddress = function() {
732
732
if ( state . connectState !== CONNECT_STATE_CONNECTED )
733
733
throw new ERR_SOCKET_DGRAM_NOT_CONNECTED ( ) ;
734
734
735
- var out = { } ;
736
- var err = state . handle . getpeername ( out ) ;
735
+ const out = { } ;
736
+ const err = state . handle . getpeername ( out ) ;
737
737
if ( err )
738
738
throw errnoException ( err , 'getpeername' ) ;
739
739
0 commit comments