Skip to content

Commit 2b21c73

Browse files
authored
Restore calls to CreateFatalHandshakeAlertToken on Android (#118765)
1 parent 59c8d55 commit 2b21c73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Android.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ public static Exception GetException(SecurityStatusPal status)
2121

2222
internal const bool StartMutualAuthAsAnonymous = false;
2323
internal const bool CanEncryptEmptyMessage = false;
24-
internal const bool CanGenerateCustomAlerts = false;
24+
25+
// There is no API to generate custom alerts on Android, but the interop layer currently
26+
// depends on SslStream calling HandshakeInternal one last time when tearing down the connection
27+
// due to handshake failures.
28+
internal const bool CanGenerateCustomAlerts = true;
2529

2630
public static void VerifyPackageInfo()
2731
{
@@ -231,7 +235,6 @@ public static SecurityStatusPal ApplyAlertToken(
231235
{
232236
// There doesn't seem to be an exposed API for writing an alert.
233237
// The API seems to assume that all alerts are generated internally.
234-
Debug.Assert(CanGenerateCustomAlerts);
235238
return new SecurityStatusPal(SecurityStatusPalErrorCode.OK);
236239
}
237240

0 commit comments

Comments
 (0)