mysql2 3.23.2 → 3.23.3-canary.508a731

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,7 +104,8 @@ class BaseConnection extends EventEmitter {
104
104
  this.handlePacket(p);
105
105
  });
106
106
  this.stream.on('data', (data) => {
107
- if (this.connectTimeout) {
107
+ // Server-side connections do not run ClientHandshake.
108
+ if (this.connectTimeout && this.config.isServer) {
108
109
  Timers.clearTimeout(this.connectTimeout);
109
110
  this.connectTimeout = null;
110
111
  }
@@ -133,6 +134,10 @@ class BaseConnection extends EventEmitter {
133
134
  if (!this.config.isServer) {
134
135
  handshakeCommand = new Commands.ClientHandshake(this.config.clientFlags);
135
136
  handshakeCommand.on('end', () => {
137
+ if (this.connectTimeout) {
138
+ Timers.clearTimeout(this.connectTimeout);
139
+ this.connectTimeout = null;
140
+ }
136
141
  // this happens when handshake finishes early either because there was
137
142
  // some fatal error or the server sent an error packet instead of
138
143
  // an hello packet (for example, 'Too many connections' error)
package/lib/base/pool.js CHANGED
@@ -254,7 +254,11 @@ class BasePool extends EventEmitter {
254
254
  });
255
255
  } catch (e) {
256
256
  conn.release();
257
- throw e;
257
+ if (typeof cmdQuery.onResult === 'function') {
258
+ cmdQuery.onResult(e);
259
+ } else {
260
+ cmdQuery.emit('error', e);
261
+ }
258
262
  }
259
263
  });
260
264
  return cmdQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.23.2",
3
+ "version": "3.23.3-canary.508a731",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "typings": "typings/mysql/index",