Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions P4VS/SwarmAPI/SSLCertificateHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
Expand All @@ -19,8 +16,7 @@ public void Init(string serverUrl)
{
ServerUrl = serverUrl;
// Override automatic validation of SSL server certificates.
ServicePointManager.ServerCertificateValidationCallback =
ValidateServerCertficate;
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertficate;
}

/// <summary>
Expand All @@ -43,21 +39,24 @@ public abstract bool ValidateServerCertficate(
SslPolicyErrors sslPolicyErrors);

#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
private bool isDisposed = false;

protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
if (isDisposed)
{
if (disposing)
{
ServicePointManager.ServerCertificateValidationCallback = null;
}
// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.
return;
}

disposedValue = true;
if (disposing)
{
ServicePointManager.ServerCertificateValidationCallback = null;
}

// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.

isDisposed = true;
}

// TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
Expand All @@ -71,8 +70,7 @@ public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
// TODO: uncomment the following line if the finalizer is overridden above.
// GC.SuppressFinalize(this);
GC.SuppressFinalize(this);
}
#endregion
}
Expand Down