emailengine-app 2.83.1 → 2.83.2
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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +10 -0
- package/data/google-crawlers.json +1 -1
- package/gettext-extract.js +95 -15
- package/lib/consts.js +3 -1
- package/lib/email-client/base-client.js +44 -20
- package/lib/email-client/credential-errors.js +3 -31
- package/lib/email-client/smtp-pool-manager.js +25 -6
- package/lib/export.js +44 -36
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +4 -2
- package/lib/imapproxy/imap-core/lib/imap-server.js +44 -11
- package/lib/imapproxy/proxy-handoff.js +10 -1
- package/lib/logger.js +3 -2
- package/lib/message-port-stream.js +23 -0
- package/lib/network-errors.js +50 -0
- package/lib/oauth/gmail.js +5 -1
- package/lib/oauth/mail-ru.js +5 -1
- package/lib/oauth/outlook.js +5 -1
- package/lib/oauth/pubsub/google.js +3 -2
- package/lib/oauth/token-fetch.js +2 -3
- package/lib/sub-script.js +10 -3
- package/lib/tools.js +16 -2
- package/package.json +10 -10
- package/sbom.json +1 -1
- package/static/licenses.html +12 -12
- package/translations/README.md +3 -2
- package/translations/messages.pot +257 -257
- package/workers/imap.js +10 -3
- package/workers/smtp.js +16 -1
package/workers/imap.js
CHANGED
|
@@ -418,10 +418,17 @@ class ConnectionHandler {
|
|
|
418
418
|
this.assignTokens.delete(account);
|
|
419
419
|
if (this.accounts.has(account)) {
|
|
420
420
|
let accountObject = this.accounts.get(account);
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
try {
|
|
422
|
+
if (accountObject.connection) {
|
|
423
|
+
await accountObject.connection.delete();
|
|
424
|
+
}
|
|
425
|
+
} finally {
|
|
426
|
+
// The account record is already gone and nothing retries the delete, so an entry
|
|
427
|
+
// left behind by a failed teardown would stay registered for the worker's lifetime
|
|
428
|
+
if (this.accounts.get(account) === accountObject) {
|
|
429
|
+
this.accounts.delete(account);
|
|
430
|
+
}
|
|
423
431
|
}
|
|
424
|
-
this.accounts.delete(account);
|
|
425
432
|
}
|
|
426
433
|
}
|
|
427
434
|
|
package/workers/smtp.js
CHANGED
|
@@ -32,6 +32,10 @@ config.service = config.service || {};
|
|
|
32
32
|
|
|
33
33
|
const { DEFAULT_MAX_SMTP_MESSAGE_SIZE } = require('../lib/consts');
|
|
34
34
|
|
|
35
|
+
// On shutdown, how long open sessions get before they are told 421 and closed. Shorter than
|
|
36
|
+
// WORKER_DRAIN_TIMEOUT in server.js, so the 421 goes out before the thread is terminated
|
|
37
|
+
const SMTP_CLOSE_TIMEOUT = 5 * 1000;
|
|
38
|
+
|
|
35
39
|
const DEFAULT_EENGINE_TIMEOUT = 10 * 1000;
|
|
36
40
|
|
|
37
41
|
const MAX_SMTP_MESSAGE_SIZE = getByteSize(readEnvValue('EENGINE_MAX_SMTP_MESSAGE_SIZE') || config.smtp.maxMessageSize) || DEFAULT_MAX_SMTP_MESSAGE_SIZE;
|
|
@@ -133,7 +137,8 @@ async function init() {
|
|
|
133
137
|
banner: 'EmailEngine MSA',
|
|
134
138
|
size: MAX_SMTP_MESSAGE_SIZE,
|
|
135
139
|
maxClients: SMTP_MAX_CLIENTS,
|
|
136
|
-
useProxy: await settings.get('smtpServerProxy')
|
|
140
|
+
useProxy: await settings.get('smtpServerProxy'),
|
|
141
|
+
closeTimeout: SMTP_CLOSE_TIMEOUT
|
|
137
142
|
};
|
|
138
143
|
|
|
139
144
|
// Reads what the API worker provisioned; this one never orders a certificate itself.
|
|
@@ -326,6 +331,16 @@ async function onCommand(command) {
|
|
|
326
331
|
|
|
327
332
|
case 'smtpReloadCertificates':
|
|
328
333
|
return await reloadCertificates();
|
|
334
|
+
|
|
335
|
+
// Shutdown drain. Signals reach the main thread only, so server.js forwards them here.
|
|
336
|
+
// Stops accepting connections and lets a submission halfway through DATA be queued and
|
|
337
|
+
// answered, instead of cutting it at process exit: a client that never sees the 250 for
|
|
338
|
+
// a message that was already queued sends it again
|
|
339
|
+
case 'close':
|
|
340
|
+
if (smtpServer) {
|
|
341
|
+
await new Promise(resolve => smtpServer.close(resolve));
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
329
344
|
default:
|
|
330
345
|
logger.debug({ msg: 'Unhandled command', command });
|
|
331
346
|
return 999;
|