From 3036f99f8f07028cc097621e4a28564715e45818 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Thu, 1 Jun 2023 19:57:09 +0200 Subject: [PATCH] - .NET API: Save TLSConfiguration instance in IedServer to avoid garbage collection (LIB61850-410) --- dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs index f9588668..b0d2c054 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs @@ -2456,6 +2456,9 @@ namespace IEC61850 /* store IedModel instance to prevent garbage collector */ private IedModel iedModel = null; + /* store TLSConfiguration instance to prevent garbage collector */ + private TLSConfiguration tlsConfiguration = null; + public IedServer(IedModel iedModel, IedServerConfig config = null) { this.iedModel = iedModel; @@ -2471,6 +2474,7 @@ namespace IEC61850 public IedServer(IedModel iedModel, TLSConfiguration tlsConfig, IedServerConfig config = null) { this.iedModel = iedModel; + this.tlsConfiguration = tlsConfig; IntPtr nativeConfig = IntPtr.Zero; IntPtr nativeTLSConfig = IntPtr.Zero; @@ -2560,6 +2564,7 @@ namespace IEC61850 self = IntPtr.Zero; internalConnectionHandler = null; this.iedModel = null; + this.tlsConfiguration = null; } } }