1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

param socket_keepalive to set keep-alive on socket

This commit is contained in:
Mohit Gupta
2014-03-25 16:33:43 -07:00
parent 4672479b91
commit d313aa5dab
2 changed files with 5 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ function RedisClient(stream, options) {
if (this.options.socket_nodelay === undefined) {
this.options.socket_nodelay = true;
}
if (this.options.socket_keepalive === undefined) {
this.options.socket_keepalive = false;
}
this.should_buffer = false;
this.command_queue_high_water = this.options.command_queue_high_water || 1000;
this.command_queue_low_water = this.options.command_queue_low_water || 0;
@@ -249,6 +252,7 @@ RedisClient.prototype.on_connect = function () {
if (this.options.socket_nodelay) {
this.stream.setNoDelay();
}
this.stream.setKeepAlive(this.options.socket_keepalive);
this.stream.setTimeout(0);
this.init_parser();