smtp-connection
Advanced tools
Comparing version 0.1.7 to 1.0.0
{ | ||
"name": "smtp-connection", | ||
"version": "0.1.7", | ||
"version": "1.0.0", | ||
"description": "Connect to SMTP servers", | ||
@@ -5,0 +5,0 @@ "main": "src/smtp-connection.js", |
@@ -119,2 +119,8 @@ 'use strict'; | ||
/** | ||
* If the socket is deemed already closed | ||
* @private | ||
*/ | ||
this._destroyed = false; | ||
if (this.options.secure) { | ||
@@ -156,4 +162,3 @@ this._secureMode = true; | ||
this._connectionTimeout = setTimeout((function() { | ||
this.emit('error', this._formatError('Connection timeout', 'ETIMEDOUT')); | ||
this.close(); | ||
this._onError('Connection timeout', 'ETIMEDOUT'); | ||
}).bind(this), this.options.connectionTimeout || 60 * 1000); | ||
@@ -291,2 +296,8 @@ | ||
if (this._destroyed) { | ||
// Connection was established after we already had canceled it | ||
this.close(); | ||
return; | ||
} | ||
this.stage = 'connected'; | ||
@@ -304,4 +315,3 @@ | ||
if (this._socket && !this._destroyed && this._currentAction === this._actionGreeting) { | ||
this.emit('error', this._formatError('Greeting never received', 'ETIMEDOUT')); | ||
this.close(); | ||
this._onError('Greeting never received', 'ETIMEDOUT'); | ||
} | ||
@@ -355,2 +365,9 @@ }).bind(this), this.options.greetingTimeout || 10000); | ||
if (this._destroyed) { | ||
// just ignore, already closed | ||
// this might happen when a socket is canceled because of reached timeout | ||
// but the socket timeout error itself receives only after | ||
return; | ||
} | ||
this.emit('error', this._formatError(err, type, data)); | ||
@@ -357,0 +374,0 @@ this.close(); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38904
9
935
0