Skip to content

Commit

Permalink
ensuring connection timeout doesn't interfere
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jun 20, 2018
1 parent 9592b6b commit a8443cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ function Connection(options) {
this.end = () => {
_addCommand = _addCommandDisabled;
if (this.timeout) clearTimeout(this.timeout);
if (_status === Status.CONNECTING || _status === Status.CONNECTED) {

if (_status !== Status.CLOSING && _status !== Status.CLOSING && _status !== Status.NOT_CONNECTED) {
_status = Status.CLOSING;
return new Promise(function(resolve, reject) {
const quitCmd = new Quit(
Expand Down Expand Up @@ -654,6 +655,7 @@ function Connection(options) {
* @private
*/
const _connectTimeoutReached = function(authFailHandler) {
this.timeout = null;
const handshake = _receiveQueue.peek();
authFailHandler(
Errors.createError(
Expand Down

0 comments on commit a8443cc

Please sign in to comment.