Skip to content

Commit 016900f

Browse files
authored
Merge pull request #1751 from dsech/tcp-nodelay
Enable TCP_NODELAY flag
2 parents c6173e5 + b694380 commit 016900f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/connection.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class Connection extends EventEmitter {
5555
// Enable keep-alive on the socket. It's disabled by default, but the
5656
// user can enable it and supply an initial delay.
5757
this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
58+
59+
// Enable TCP_NODELAY flag. This is needed so that the network packets
60+
// are sent immediately to the server
61+
this.stream.setNoDelay(true);
5862
}
5963
// if stream is a function, treat it as "stream agent / factory"
6064
} else if (typeof opts.config.stream === 'function') {

0 commit comments

Comments
 (0)