File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ class Connection extends EventEmitter {
36
36
opts . config . port ,
37
37
opts . config . host
38
38
) ;
39
+
40
+ // Enable keep-alive on the socket. It's disabled by default, but the
41
+ // user can enable it and supply an initial delay.
42
+ this . stream . setKeepAlive ( true , this . config . keepAliveInitialDelay ) ;
39
43
}
40
44
// if stream is a function, treat it as "stream agent / factory"
41
45
} else if ( typeof opts . config . stream === 'function' ) {
@@ -44,11 +48,6 @@ class Connection extends EventEmitter {
44
48
this . stream = opts . config . stream ;
45
49
}
46
50
47
- // Enable keep-alive on the socket. It's disabled by default, but the
48
- // user can enable it and supply an initial delay.
49
- if ( typeof this . stream . setKeepAlive === 'function' && this . config . enableKeepAlive )
50
- this . stream . setKeepAlive ( true , this . config . keepAliveInitialDelay ) ;
51
-
52
51
this . _internalId = _connectionId ++ ;
53
52
this . _commands = new Queue ( ) ;
54
53
this . _command = null ;
You can’t perform that action at this time.
0 commit comments