diff --git a/lib/client.js b/lib/client.js index 5d1af39..32b1d08 100644 --- a/lib/client.js +++ b/lib/client.js @@ -63,9 +63,9 @@ p.connect = function(callback) { }); con.once('backendKeyData', function(msg) { - self.processID = msg.processID; - self.secretKey = msg.secretKey; - }); + self.processID = msg.processID; + self.secretKey = msg.secretKey; + }); //hook up query handling events to connection //after the connection initially becomes ready for queries @@ -139,22 +139,22 @@ p.connect = function(callback) { }; p.cancel = function(client, query) { - if (client.activeQuery == query) { - var con = this.connection; + if (client.activeQuery == query) { + var con = this.connection; - if(this.host && this.host.indexOf('/') === 0) { - con.connect(this.host + '/.s.PGSQL.' + this.port); - } else { - con.connect(this.port, this.host); - } + if(this.host && this.host.indexOf('/') === 0) { + con.connect(this.host + '/.s.PGSQL.' + this.port); + } else { + con.connect(this.port, this.host); + } - //once connection is established send cancel message - con.on('connect', function() { - con.cancel(client.processID, client.secretKey); - }); - } - else if (client.queryQueue.indexOf(query) != -1) - client.queryQueue.splice(client.queryQueue.indexOf(query), 1); + //once connection is established send cancel message + con.on('connect', function() { + con.cancel(client.processID, client.secretKey); + }); + } + else if (client.queryQueue.indexOf(query) != -1) + client.queryQueue.splice(client.queryQueue.indexOf(query), 1); }; p._pulseQueryQueue = function() {