Skip to content

Commit

Permalink
Correct the debug info when connecting to the unix domain socks
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Sep 30, 2015
1 parent 5e3ba24 commit 61be901
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,23 @@ Redis.prototype.parseOptions = function () {
}
};

/** Change instance's status
/**
* Change instance's status
* @private
*/
Redis.prototype.setStatus = function (status, arg) {
var remoteHost = this.stream && this.stream.remoteAddress || this.options.host;
var remotePort = this.stream && this.stream.remotePort || this.options.port;
debug('status[%s:%s]: %s -> %s', remoteHost, remotePort, this.status || '[empty]', status);
var address = this.options.path;
if (!address) {
var remoteHost = this.stream ? this.stream.remoteAddress : this.options.host;
var remotePort = this.stream ? this.stream.remotePort : this.options.port;
address = remoteHost + ':' + remotePort;
}

debug('status[%s]: %s -> %s', address, this.status || '[empty]', status);
this.status = status;
process.nextTick(this.emit.bind(this, status, arg));
};


/**
* Create a connection to Redis.
* This method will be invoked automatically when creating a new Redis instance.
Expand Down

0 comments on commit 61be901

Please sign in to comment.