Merge pull request #5330 from alexanderkyte/dedup_mkbundle
authorAlexander Kyte <alexmkyte@gmail.com>
Wed, 30 Aug 2017 19:59:18 +0000 (15:59 -0400)
committerGitHub <noreply@github.com>
Wed, 30 Aug 2017 19:59:18 +0000 (15:59 -0400)
[runtime] Add Dedup Support to MkBundle

mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs
mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs
mcs/class/System/Mono.Btls/MonoBtlsContext.cs
mcs/class/System/Mono.Btls/MonoBtlsProvider.cs
mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs

index 05f507a852eb93b0436aec44faf77e6ce190d270..5a03262e229f281a0ce751f4a28c6ed160902969 100644 (file)
@@ -163,5 +163,14 @@ namespace Mono.Security.Interface
                        X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
                        ref MonoSslPolicyErrors errors, ref int status11);
 #endregion
+
+#region Misc
+
+               internal abstract bool SupportsCleanShutdown {
+                       get;
+               }
+
+#endregion
+
        }
 }
index 6a1bf86ed1fae893c05082843b554ae1db4fae7b..ee7e216cc2103ee31a529f16105bfeb6f7ab09c9 100644 (file)
@@ -86,6 +86,13 @@ namespace Mono.Security.Interface
                        get; set;
                }
 
+               /*
+                * This is only supported if MonoTlsProvider.SupportsCleanShutdown is true.
+                */
+               internal bool SendCloseNotify {
+                       get; set;
+               }
+
                /*
                 * If you set this here, then it will override 'ServicePointManager.SecurityProtocol'.
                 */
@@ -173,6 +180,7 @@ namespace Mono.Security.Interface
                        EnabledProtocols = other.EnabledProtocols;
                        EnabledCiphers = other.EnabledCiphers;
                        CertificateValidationTime = other.CertificateValidationTime;
+                       SendCloseNotify = other.SendCloseNotify;
                        if (other.TrustAnchors != null)
                                TrustAnchors = new X509CertificateCollection (other.TrustAnchors);
                        if (other.CertificateSearchPaths != null) {
index d30f1f484f90f434fcfc5dfcccfad05ad0fd9387..0cc69e47648db2ed9fc45b7bc8af47bd83713b5d 100644 (file)
@@ -848,24 +848,7 @@ namespace Mono.AppleTls
 
                public override void Shutdown ()
                {
-                       if (Interlocked.Exchange (ref pendingIO, 1) == 1)
-                               throw new InvalidOperationException ();
-
-                       Debug ("Shutdown");
-
-                       lastException = null;
-
-                       try {
-                               if (closed || disposed)
-                                       return;
-
-                               var status = SSLClose (Handle);
-                               Debug ("Shutdown done: {0}", status);
-                               CheckStatusAndThrow (status);
-                       } finally {
-                               closed = true;
-                               pendingIO = 0;
-                       }
+                       closed = true;
                }
 
                #endregion
index 4fdabfd3ae3d22b8658a5a86dd5db672cc0edcd1..9582f6aceb74a6d3c23d1dbafdb3b77f2e520530 100644 (file)
@@ -65,6 +65,10 @@ namespace Mono.AppleTls
                        get { return true; }
                }
 
+               internal override bool SupportsCleanShutdown {
+                       get { return false; }
+               }
+
                public override SslProtocols SupportedProtocols {
                        get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
                }
index 335be7d3090989200f346caef2b04bf420b998ed..559db4aca5d4f8288686b51369d6324a1114f5fd 100644 (file)
@@ -357,7 +357,8 @@ namespace Mono.Btls
                public override void Shutdown ()
                {
                        Debug ("Shutdown!");
-//                     ssl.SetQuietShutdown ();
+                       if (Settings == null || !Settings.SendCloseNotify)
+                               ssl.SetQuietShutdown ();
                        ssl.Shutdown ();
                }
 
index bd979345e0debc693cfe43b9c5db0c7ca096277e..0db248b991264239131aac70f934d6557e2c1fd0 100644 (file)
@@ -75,6 +75,10 @@ namespace Mono.Btls
                        get { return true; }
                }
 
+               internal override bool SupportsCleanShutdown {
+                       get { return true; }
+               }
+
                public override SslProtocols SupportedProtocols {
                        get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
                }
index a67b1ff069e9c67c83a61f73e65c04165ad54af6..d5d66c2f5eedd5e28a0b57a6007102630e024cad 100644 (file)
@@ -68,6 +68,10 @@ namespace Mono.Net.Security
                        get { return false; }
                }
 
+               internal override bool SupportsCleanShutdown {
+                       get { return false; }
+               }
+
                public override SslProtocols SupportedProtocols {
                        get { return SslProtocols.Tls; }
                }