Skip to content

Commit

Permalink
Fixed previous commit to only disconnect when the Exception isn't Aut…
Browse files Browse the repository at this point in the history
…henticationException
  • Loading branch information
jstedfast committed Jan 15, 2024
1 parent d5770f9 commit 3d1487d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MailKit/Net/Smtp/AsyncSmtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public override async Task AuthenticateAsync (SaslMechanism mechanism, Cancellat
response = await Stream.SendCommandAsync ("\r\n", cancellationToken).ConfigureAwait (false);
saslException = ex;
}
} catch {
} catch (Exception ex) when (ex is not AuthenticationException) {
Disconnect (uri.Host, uri.Port, GetSecureSocketOptions (uri), false);
throw;
} finally {
Expand Down
2 changes: 1 addition & 1 deletion MailKit/Net/Smtp/SmtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ public override void Authenticate (SaslMechanism mechanism, CancellationToken ca
response = Stream.SendCommand ("\r\n", cancellationToken);
saslException = ex;
}
} catch {
} catch (Exception ex) when (ex is not AuthenticationException) {
Disconnect (uri.Host, uri.Port, GetSecureSocketOptions (uri), false);
throw;
} finally {
Expand Down

0 comments on commit 3d1487d

Please sign in to comment.