Socket
Socket
Sign inDemoInstall

nodemailer-smtp-pool

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodemailer-smtp-pool - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

10

package.json
{
"name": "nodemailer-smtp-pool",
"version": "1.1.3",
"version": "1.1.4",
"description": "SMTP transport for Nodemailer",

@@ -29,9 +29,9 @@ "main": "src/smtp-pool.js",

"devDependencies": {
"chai": "^3.3.0",
"chai": "^3.4.1",
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.3",
"grunt-mocha-test": "^0.12.7",
"mocha": "^2.3.3",
"smtp-server": "^1.6.0"
"mocha": "^2.3.4",
"smtp-server": "^1.7.1"
}
}
}

@@ -94,3 +94,3 @@ 'use strict';

for (var i = this._connections.length - 1; i >= 0; i--) {
if (this._connections[i].available) {
if (this._connections[i] && this._connections[i].available) {
connection = this._connections[i];

@@ -103,4 +103,2 @@ connection.close();

});
this._connections.splice(i, 1);
}

@@ -214,14 +212,17 @@ }

// remove the erroneus connection from connections list
for (var i = 0, len = this._connections.length; i < len; i++) {
if (this._connections[i] === connection) {
this._connections.splice(i, 1);
break;
}
this._removeConnection(connection);
this._continueProcessing();
}.bind(this));
connection.once('close', function() {
if (this.options.debug) {
this.emit('log', {
type: 'close',
message: 'Connection #' + connection.id + ' was closed'
});
}
if (this._closed) {
this.close();
} else {
setTimeout(this._processMessages.bind(this), 100);
}
this._removeConnection(connection);
this._continueProcessing();
}.bind(this));

@@ -235,2 +236,27 @@

/**
* Continue to process message if the pool hasn't closed
*/
SMTPPool.prototype._continueProcessing = function() {
if (this._closed) {
this.close();
} else {
setTimeout(this._processMessages.bind(this), 100);
}
};
/**
* Remove resource from pool
*
* @param {Object} connection The PoolResource to remove
*/
SMTPPool.prototype._removeConnection = function(connection) {
for (var i = 0, len = this._connections.length; i < len; i++) {
if (this._connections[i] === connection) {
this._connections.splice(i, 1);
break;
}
}
};
/**
* Checks if connections have hit current rate limit and if so, queues the availability callback

@@ -321,4 +347,4 @@ *

this.connection.once('close', function() {
this.emit('error', new Error('Connection was closed'));
this.connection.once('end', function() {
this.close();
if (returned) {

@@ -411,5 +437,7 @@ return;

PoolResource.prototype.close = function() {
this._connected = false;
if (this.connection) {
this.connection.close();
}
this.emit('close');
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc