From ba859f628582fa639e9dc7da9900fc84e5eb2937 Mon Sep 17 00:00:00 2001 From: Tino Hager Date: Tue, 1 Oct 2024 09:45:07 +0200 Subject: [PATCH] Fix missing session created on failure (#239) --- Src/SmtpServer/SmtpSessionManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/SmtpServer/SmtpSessionManager.cs b/Src/SmtpServer/SmtpSessionManager.cs index e02ab8d..d490028 100644 --- a/Src/SmtpServer/SmtpSessionManager.cs +++ b/Src/SmtpServer/SmtpSessionManager.cs @@ -35,12 +35,12 @@ async Task RunAsync(SmtpSessionHandle handle, CancellationToken cancellationToke try { + _smtpServer.OnSessionCreated(new SessionEventArgs(handle.SessionContext)); + await UpgradeAsync(handle, linkedTokenSource.Token); linkedTokenSource.Token.ThrowIfCancellationRequested(); - _smtpServer.OnSessionCreated(new SessionEventArgs(handle.SessionContext)); - await handle.Session.RunAsync(linkedTokenSource.Token); _smtpServer.OnSessionCompleted(new SessionEventArgs(handle.SessionContext));