Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/class/System/Mono.Net.Security/MonoTlsStream.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
index 4573b9c380f..935df6acaf0 100644
--- a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
+++ b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
@@ -132,8 +132,7 @@ namespace Mono.Net.Security
status = WebExceptionStatus.SecureChannelFailure;
request.ServicePoint.UpdateClientCertificate (null);
- sslStream.Dispose ();
- sslStream = null;
+ CloseSslStream ();
throw;
}
@@ -142,8 +141,7 @@ namespace Mono.Net.Security
await sslStream.WriteAsync (tunnel.Data, 0, tunnel.Data.Length, cancellationToken).ConfigureAwait (false);
} catch {
status = WebExceptionStatus.SendFailure;
- sslStream.Dispose ();
- sslStream = null;
+ CloseSslStream ();
throw;
}
@@ -155,6 +153,10 @@ namespace Mono.Net.Security
public void Dispose ()
{
+ CloseSslStream ();
+ }
+
+ void CloseSslStream () {
if (sslStream != null) {
sslStream.Dispose ();
sslStream = null;