Skip to content

Commit

Permalink
fix: keepAliveInitialDelay not taking effect (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
hechaoWeb authored Jun 12, 2023
1 parent ff3c36c commit 585911c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class Connection extends EventEmitter {

// Optionally enable keep-alive on the socket.
if (this.config.enableKeepAlive) {
this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
this.stream.on('connect', () => {
this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
});
}

// Enable TCP_NODELAY flag. This is needed so that the network packets
Expand Down

0 comments on commit 585911c

Please sign in to comment.