This commit is contained in:
Martin Cizek 2020-09-18 06:15:25 +02:00
parent d32a765ee9
commit f3804bbca6
1 changed files with 4 additions and 4 deletions
lib/client

View File

@ -115,8 +115,8 @@ function Client (options) {
this._nextServer = Math.floor(Math.random() * this.urls.length) this._nextServer = Math.floor(Math.random() * this.urls.length)
// updated in connectSocket() after each connect // updated in connectSocket() after each connect
this.host = undefined this.host = undefined
this.port = false this.port = undefined
this.secure = false this.secure = undefined
this.url = undefined this.url = undefined
this.tlsOptions = options.tlsOptions this.tlsOptions = options.tlsOptions
this.socketPath = options.socketPath || false this.socketPath = options.socketPath || false
@ -827,7 +827,7 @@ Client.prototype.connect = function connect () {
var port = (server && server.port) || self.socketPath var port = (server && server.port) || self.socketPath
var host = server && server.hostname var host = server && server.hostname
if (self.secure) { if (server && server.secure) {
socket = tls.connect(port, host, self.tlsOptions) socket = tls.connect(port, host, self.tlsOptions)
socket.once('secureConnect', onConnect) socket.once('secureConnect', onConnect)
} else { } else {
@ -996,7 +996,7 @@ Client.prototype.connect = function connect () {
initialDelay: 1, initialDelay: 1,
maxDelay: 2 maxDelay: 2
}) })
failAfter = 1 failAfter = this.urls.length || 1
} }
retry.failAfter(failAfter) retry.failAfter(failAfter)