@@ -119,6 +119,8 @@ const { kTimeout } = require('internal/timers');
119
119
const DEFAULT_IPV4_ADDR = '0.0.0.0' ;
120
120
const DEFAULT_IPV6_ADDR = '::' ;
121
121
122
+ const isWindows = process . platform === 'win32' ;
123
+
122
124
function noop ( ) { }
123
125
124
126
function getFlags ( ipv6Only ) {
@@ -336,8 +338,7 @@ function Socket(options) {
336
338
this [ async_id_symbol ] = this . _handle . getAsyncId ( ) ;
337
339
338
340
if ( ( fd === 1 || fd === 2 ) &&
339
- ( this . _handle instanceof Pipe ) &&
340
- process . platform === 'win32' ) {
341
+ ( this . _handle instanceof Pipe ) && isWindows ) {
341
342
// Make stdout and stderr blocking on Windows
342
343
err = this . _handle . setBlocking ( true ) ;
343
344
if ( err )
@@ -1028,7 +1029,7 @@ function lookupAndConnect(self, options) {
1028
1029
hints : options . hints || 0
1029
1030
} ;
1030
1031
1031
- if ( process . platform !== 'win32' &&
1032
+ if ( ! isWindows &&
1032
1033
dnsopts . family !== 4 &&
1033
1034
dnsopts . family !== 6 &&
1034
1035
dnsopts . hints === 0 ) {
@@ -1227,7 +1228,7 @@ function createServerHandle(address, port, addressType, fd, flags) {
1227
1228
assert ( ! address && ! port ) ;
1228
1229
} else if ( port === - 1 && addressType === - 1 ) {
1229
1230
handle = new Pipe ( PipeConstants . SERVER ) ;
1230
- if ( process . platform === 'win32' ) {
1231
+ if ( isWindows ) {
1231
1232
const instances = parseInt ( process . env . NODE_PENDING_PIPE_INSTANCES ) ;
1232
1233
if ( ! NumberIsNaN ( instances ) ) {
1233
1234
handle . setPendingInstances ( instances ) ;
@@ -1711,7 +1712,7 @@ Server.prototype.unref = function() {
1711
1712
let _setSimultaneousAccepts ;
1712
1713
let warnSimultaneousAccepts = true ;
1713
1714
1714
- if ( process . platform === 'win32' ) {
1715
+ if ( isWindows ) {
1715
1716
let simultaneousAccepts ;
1716
1717
1717
1718
_setSimultaneousAccepts = function ( handle ) {
0 commit comments