update
This commit is contained in:
parent
6fcc3feb73
commit
f058b2d1e7
@ -1193,7 +1193,6 @@ SmtpLogger.debug(`Parsed email subject: ${subject}`, { subject });
|
||||
}
|
||||
}
|
||||
}, 100); // Short delay before retry
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,10 @@
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import type { Email } from '../../core/classes.email.js';
|
||||
import type { UnifiedEmailServer } from '../../routing/classes.unified.email.server.js';
|
||||
import type { SmtpState, SmtpCommand } from './constants.js';
|
||||
|
||||
// Re-export types from other modules
|
||||
export { SmtpState } from '../interfaces.js';
|
||||
export type { SmtpCommand } from './constants.js';
|
||||
|
||||
/**
|
||||
* Interface for components that need cleanup
|
||||
|
@ -738,4 +738,50 @@ export class SmtpServer implements ISmtpServer {
|
||||
this.recoveryState.recovering = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up all component resources
|
||||
*/
|
||||
public async destroy(): Promise<void> {
|
||||
SmtpLogger.info('Destroying SMTP server components');
|
||||
|
||||
// Destroy all components in parallel
|
||||
const destroyPromises: Promise<void>[] = [];
|
||||
|
||||
if (this.sessionManager && typeof this.sessionManager.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.sessionManager.destroy()));
|
||||
}
|
||||
|
||||
if (this.connectionManager && typeof this.connectionManager.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.connectionManager.destroy()));
|
||||
}
|
||||
|
||||
if (this.commandHandler && typeof this.commandHandler.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.commandHandler.destroy()));
|
||||
}
|
||||
|
||||
if (this.dataHandler && typeof this.dataHandler.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.dataHandler.destroy()));
|
||||
}
|
||||
|
||||
if (this.tlsHandler && typeof this.tlsHandler.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.tlsHandler.destroy()));
|
||||
}
|
||||
|
||||
if (this.securityHandler && typeof this.securityHandler.destroy === 'function') {
|
||||
destroyPromises.push(Promise.resolve(this.securityHandler.destroy()));
|
||||
}
|
||||
|
||||
await Promise.all(destroyPromises);
|
||||
|
||||
// Clear recovery state
|
||||
this.recoveryState = {
|
||||
recovering: false,
|
||||
currentRecoveryAttempt: 0,
|
||||
maxRecoveryAttempts: 3,
|
||||
lastError: null
|
||||
};
|
||||
|
||||
SmtpLogger.info('All SMTP server components destroyed');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user