Skip to content

Commit 365b89b

Browse files
committed
clear connect timeout when connection is closed
1 parent e271557 commit 365b89b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/connection.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ Connection.prototype._handleFatalError = function(err) {
180180
};
181181

182182
Connection.prototype._handleNetworkError = function(err) {
183-
console.log('_handleNetworkError AAAAA NETWORK ERROR');
184183
this._handleFatalError(err);
185184
};
186185

@@ -807,6 +806,10 @@ Connection.prototype.destroy = function() {
807806
};
808807

809808
Connection.prototype.close = function() {
809+
if (this.connectTimeout) {
810+
Timers.clearTimeout(this.connectTimeout);
811+
this.connectTimeout = null;
812+
}
810813
this._closing = true;
811814
this.stream.end();
812815
var connection = this;

test/integration/connection/test-connect-time-error.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ portfinder.getPort(function(err, port) {
2525
});
2626

2727
connection.query('select 1+1', function(err) {
28-
console.log('Here! 1');
29-
console.log(err);
3028
assert.equal(err.message, ERROR_TEXT);
3129
});
3230

3331
connection.query('select 1+2', function(err) {
34-
console.log('Here! 2');
3532
assert.equal(err.message, ERROR_TEXT);
3633
connection.close();
3734
server._server.close();

0 commit comments

Comments
 (0)