Working on disconnect issue

This commit is contained in:
Brian M. Carlson 2017-06-13 17:02:23 -05:00 committed by Brian C
parent 3a7b226fe3
commit 72560850d7

View File

@ -409,17 +409,15 @@ Client.prototype.query = function(config, values, callback) {
Client.prototype.end = function(cb) {
this._ending = true;
if (this.activeQuery) {
return this.connection.stream.end()
}
this.connection.end();
if (cb) {
this.connection.once('end', cb);
} else {
return new global.Promise((resolve) => {
this.connection.once('end', resolve);
});
this.connection.end();
return;
}
return new global.Promise((resolve) => {
this.connection.end();
this.connection.once('end', resolve);
});
};
Client.md5 = function(string) {