From 1c50c2a2d033c8f075f03e30c01ffd3d5b1e246e Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 5 Aug 2015 02:42:58 +0200 Subject: [PATCH] Move Instrumentation from TlsSettings into UserSettings (TlsSettings will go away). --- .../Mono.Security.NewTls.Interface.csproj | 2 +- .../Mono.Security.NewTls/UserSettings.cs | 9 +++++++++ .../MonoConnection.cs | 2 +- .../Mono.Security.NewTls/TlsConfiguration.cs | 16 ---------------- .../Mono.Security.NewTls/TlsContext.cs | 16 +++++++++------- .../Mono.Security.NewTls/TlsSettings.cs | 8 -------- 6 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Mono.Security.NewTls.Interface/Mono.Security.NewTls.Interface.csproj b/Mono.Security.NewTls.Interface/Mono.Security.NewTls.Interface.csproj index 82f6812..e215b6c 100644 --- a/Mono.Security.NewTls.Interface/Mono.Security.NewTls.Interface.csproj +++ b/Mono.Security.NewTls.Interface/Mono.Security.NewTls.Interface.csproj @@ -18,7 +18,7 @@ full false bin\Debug - DEBUG;PCL + DEBUG;PCL;INSTRUMENTATION prompt 4 false diff --git a/Mono.Security.NewTls.Interface/Mono.Security.NewTls/UserSettings.cs b/Mono.Security.NewTls.Interface/Mono.Security.NewTls/UserSettings.cs index 7f4c639..16d2de4 100644 --- a/Mono.Security.NewTls.Interface/Mono.Security.NewTls/UserSettings.cs +++ b/Mono.Security.NewTls.Interface/Mono.Security.NewTls/UserSettings.cs @@ -91,6 +91,15 @@ namespace Mono.Security.NewTls hasSignatureParameters = true; } } + + + #if INSTRUMENTATION + + public Instrumentation Instrumentation { + get; set; + } + + #endif } } diff --git a/Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/MonoConnection.cs b/Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/MonoConnection.cs index 814858c..8584604 100644 --- a/Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/MonoConnection.cs +++ b/Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/MonoConnection.cs @@ -115,7 +115,7 @@ namespace Mono.Security.NewTls.TestProvider settings = GetSettings (userSettings); if (instrumentation != null) - ((TlsSettings)settings).Instrumentation = instrumentation; + ((TlsSettings)settings).UserSettings.Instrumentation = instrumentation; monoSslStream = await Start (ctx, stream, settings, cancellationToken); return monoSslStream; diff --git a/Mono.Security.NewTls/Mono.Security.NewTls/TlsConfiguration.cs b/Mono.Security.NewTls/Mono.Security.NewTls/TlsConfiguration.cs index 65571ad..0c4b768 100644 --- a/Mono.Security.NewTls/Mono.Security.NewTls/TlsConfiguration.cs +++ b/Mono.Security.NewTls/Mono.Security.NewTls/TlsConfiguration.cs @@ -191,22 +191,6 @@ namespace Mono.Security.NewTls PrivateKey = null; Certificate = null; } - - #if INSTRUMENTATION - - public bool HasInstrumentation { - get { return TlsSettings != null && TlsSettings.Instrumentation != null; } - } - - public Instrumentation Instrumentation { - get { - if (!HasInstrumentation) - throw new InvalidOperationException (); - return TlsSettings.Instrumentation; - } - } - - #endif } } diff --git a/Mono.Security.NewTls/Mono.Security.NewTls/TlsContext.cs b/Mono.Security.NewTls/Mono.Security.NewTls/TlsContext.cs index 61087bf..3072123 100644 --- a/Mono.Security.NewTls/Mono.Security.NewTls/TlsContext.cs +++ b/Mono.Security.NewTls/Mono.Security.NewTls/TlsContext.cs @@ -104,13 +104,15 @@ namespace Mono.Security.NewTls this.eventSink = eventSink; #if INSTRUMENTATION - if (configuration.HasInstrumentation) { - if (configuration.Instrumentation.HasSignatureInstrument) - signatureProvider = configuration.Instrumentation.SignatureInstrument; - if (configuration.Instrumentation.HasSettingsInstrument) - settingsProvider = configuration.Instrumentation.SettingsInstrument; - handshakeInstruments = configuration.Instrumentation.HandshakeInstruments; - instrumentationEventSink = configuration.Instrumentation.EventSink; + var userSettings = configuration.TlsSettings != null ? configuration.TlsSettings.UserSettings : null; + var instrumentation = userSettings != null ? userSettings.Instrumentation : null; + if (instrumentation != null) { + if (instrumentation.HasSignatureInstrument) + signatureProvider = instrumentation.SignatureInstrument; + if (instrumentation.HasSettingsInstrument) + settingsProvider = instrumentation.SettingsInstrument; + handshakeInstruments = instrumentation.HandshakeInstruments; + instrumentationEventSink = instrumentation.EventSink; } #endif diff --git a/Mono.Security.NewTls/Mono.Security.NewTls/TlsSettings.cs b/Mono.Security.NewTls/Mono.Security.NewTls/TlsSettings.cs index f215462..941cc69 100644 --- a/Mono.Security.NewTls/Mono.Security.NewTls/TlsSettings.cs +++ b/Mono.Security.NewTls/Mono.Security.NewTls/TlsSettings.cs @@ -42,14 +42,6 @@ namespace Mono.Security.NewTls } #endregion - - #if INSTRUMENTATION - - public Instrumentation Instrumentation { - get; set; - } - - #endif } }