nodemailer
Advanced tools
Comparing version 5.1.1 to 6.0.0
# CHANGELOG | ||
## 6.0.0 2019-03-25 | ||
- SMTPConnection: use removeListener instead of removeAllListeners (xr0master) [ddc4af15] | ||
Using removeListener should fix memory leak with Node.js streams | ||
## 5.1.1 2019-01-09 | ||
@@ -4,0 +9,0 @@ |
@@ -60,3 +60,3 @@ 'use strict'; | ||
// setup emit handlers for the transporter | ||
if (typeof transporter.on === 'function') { | ||
if (typeof this.transporter.on === 'function') { | ||
// deprecated log interface | ||
@@ -63,0 +63,0 @@ this.transporter.on('log', log => { |
@@ -185,2 +185,11 @@ 'use strict'; | ||
this._closing = false; | ||
/** | ||
* Callbacks for socket's listeners | ||
*/ | ||
this._onSocketData = (chunk) => this._onData(chunk); | ||
this._onSocketError = (error) => this._onError(error, 'ESOCKET', false, 'CONN'); | ||
this._onSocketClose = () => this._onClose(); | ||
this._onSocketEnd = () => this._onEnd(); | ||
this._onSocketTimeout = () => this._onTimeout(); | ||
} | ||
@@ -224,5 +233,3 @@ | ||
this._socket.on('error', err => { | ||
this._onError(err, 'ECONNECTION', false, 'CONN'); | ||
}); | ||
this._socket.on('error', this._onSocketError); | ||
}; | ||
@@ -688,13 +695,13 @@ | ||
// clear existing listeners for the socket | ||
this._socket.removeAllListeners('data'); | ||
this._socket.removeAllListeners('timeout'); | ||
this._socket.removeAllListeners('close'); | ||
this._socket.removeAllListeners('end'); | ||
this._socket.removeListener('data', this._onSocketData); | ||
this._socket.removeListener('timeout', this._onSocketTimeout); | ||
this._socket.removeListener('close', this._onSocketClose); | ||
this._socket.removeListener('end', this._onSocketEnd); | ||
this._socket.on('data', chunk => this._onData(chunk)); | ||
this._socket.once('close', errored => this._onClose(errored)); | ||
this._socket.once('end', () => this._onEnd()); | ||
this._socket.on('data', this._onSocketData); | ||
this._socket.once('close', this._onSocketClose); | ||
this._socket.once('end', this._onSocketEnd); | ||
this._socket.setTimeout(this.options.socketTimeout || SOCKET_TIMEOUT); | ||
this._socket.on('timeout', () => this._onTimeout()); | ||
this._socket.on('timeout', this._onSocketTimeout); | ||
@@ -863,4 +870,4 @@ this._greetingTimeout = setTimeout(() => { | ||
// we can safely keep 'error', 'end', 'close' etc. events | ||
this._socket.removeAllListeners('data'); // incoming data is going to be gibberish from this point onwards | ||
this._socket.removeAllListeners('timeout'); // timeout will be re-set for the new socket object | ||
this._socket.removeListener('data', this._onSocketData); // incoming data is going to be gibberish from this point onwards | ||
this._socket.removeListener('timeout', this._onSocketTimeout); // timeout will be re-set for the new socket object | ||
@@ -883,6 +890,6 @@ let socketPlain = this._socket; | ||
this.upgrading = false; | ||
this._socket.on('data', chunk => this._onData(chunk)); | ||
this._socket.on('data', this._onSocketData); | ||
socketPlain.removeAllListeners('close'); | ||
socketPlain.removeAllListeners('end'); | ||
socketPlain.removeListener('close', this._onSocketClose); | ||
socketPlain.removeListener('end', this._onSocketEnd); | ||
@@ -893,8 +900,8 @@ return callback(null, true); | ||
this._socket.on('error', err => this._onError(err, 'ESOCKET', false, 'CONN')); | ||
this._socket.once('close', errored => this._onClose(errored)); | ||
this._socket.once('end', () => this._onEnd()); | ||
this._socket.on('error', this._onSocketError); | ||
this._socket.once('close', this._onSocketClose); | ||
this._socket.once('end', this._onSocketEnd); | ||
this._socket.setTimeout(this.options.socketTimeout || SOCKET_TIMEOUT); // 10 min. | ||
this._socket.on('timeout', () => this._onTimeout()); | ||
this._socket.on('timeout', this._onSocketTimeout); | ||
@@ -901,0 +908,0 @@ // resume in case the socket was paused |
{ | ||
"name": "nodemailer", | ||
"version": "5.1.1", | ||
"version": "6.0.0", | ||
"description": "Easy as cake e-mail sending from your Node.js applications", | ||
@@ -26,4 +26,4 @@ "main": "lib/nodemailer.js", | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "3.3.0", | ||
"grunt": "1.0.3", | ||
"eslint-config-prettier": "4.1.0", | ||
"grunt": "1.0.4", | ||
"grunt-cli": "1.3.2", | ||
@@ -39,3 +39,3 @@ "grunt-eslint": "21.0.0", | ||
"proxy-test-server": "1.0.0", | ||
"sinon": "7.2.2", | ||
"sinon": "7.3.0", | ||
"smtp-server": "3.5.0" | ||
@@ -42,0 +42,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
460422
11265