node_modules: update (#338)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-03 10:23:35 +02:00
1 parent e1936242ed
commit a9c5eb6c35
39 files changed
+799 -388

No files matched your search

+27 -29
View File
@@ -66,7 +66,7 @@ class PoolResource extends node_events_1.EventEmitter {
method: 'XOAUTH2'
};
oauth2.on('token', (token) => this.pool.mailer.emit('token', token));
oauth2.on('error', err => this.emit('error', err));
oauth2.on('error', err => this._fail(err));
break;
}
default:
@@ -89,6 +89,19 @@ class PoolResource extends node_events_1.EventEmitter {
this._connected = false;
this.messages = 0;
this.available = true;
this._failed = false;
}
/**
* Emits 'error' for the first failure only. A dead resource can report the same failure more
* than once (the connection error, then the send callback), the pool handles it once
* @internal
*/
_fail(err) {
if (this._failed) {
return;
}
this._failed = true;
this.emit('error', err);
}
/**
* Initiates a connection to the SMTP server
@@ -101,7 +114,7 @@ class PoolResource extends node_events_1.EventEmitter {
// nothing was connected, so no 'close' event is coming that would free the
// slot this resource holds in the pool, report the failure the way a failed
// login does
this.emit('error', err);
this._fail(err);
return callback(err);
}
let returned = false;
@@ -118,8 +131,8 @@ class PoolResource extends node_events_1.EventEmitter {
options = Object.assign((0, index_js_2.assign)(false, options), socketOptions);
}
this.connection = new index_js_1.default(options);
this.connection.once('error', err => {
this.emit('error', err);
this.connection.on('error', err => {
this._fail(err);
if (returned) {
return;
}
@@ -128,31 +141,16 @@ class PoolResource extends node_events_1.EventEmitter {
});
this.connection.once('end', () => {
this.close();
returned = true;
});
this.connection.connect(err => {
if (returned) {
return;
}
returned = true;
const timer = setTimeout(() => {
if (returned) {
return;
}
// still have not returned, this means we have an unexpected connection close
const err = new Error('Unexpected socket close');
if (this.connection && this.connection.upgrading) {
// starttls connection errors
err.code = errors.ETLS;
}
callback(err);
}, 1000);
try {
timer.unref();
}
catch (_E) {
// Ignore. Happens on envs with non-node timer implementation
}
});
this.connection.connect(() => {
if (returned) {
if (err) {
// a close before the greeting, the 'end' that follows closes this resource
// and the pool requeues or fails the entry, bounded by maxRequeues
returned = true;
return;
}
if (this.auth && (this.connection.allowsAuth || options.forceAuth)) {
@@ -163,7 +161,7 @@ class PoolResource extends node_events_1.EventEmitter {
returned = true;
if (err) {
this.connection.close();
this.emit('error', err);
this._fail(err);
return callback(err);
}
this._connected = true;
@@ -215,7 +213,7 @@ class PoolResource extends node_events_1.EventEmitter {
this.messages++;
if (err) {
this.connection.close();
this.emit('error', err);
this._fail(err);
return callback(err);
}
info.envelope = {
@@ -228,7 +226,7 @@ class PoolResource extends node_events_1.EventEmitter {
const err = new Error('Resource exhausted');
err.code = errors.EMAXLIMIT;
this.connection.close();
this.emit('error', err);
this._fail(err);
}
else {
this.pool._checkRateLimit(() => {