Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryCachedCredential()

static SafeFreeCredentials System.Net.Security.SslSessionsCache.TryCachedCredential ( byte[] thumbPrint,
SslProtocols sslProtocols,
bool isServer,
EncryptionPolicy encryptionPolicy )
inlinestaticpackage

Definition at line 94 of file SslSessionsCache.cs.

95 {
96 if (s_cachedCreds.IsEmpty)
97 {
98 if (System.Net.NetEventSource.Log.IsEnabled())
99 {
100 System.Net.NetEventSource.Info(null, $"Not found, Current Cache Count = {s_cachedCreds.Count}", "TryCachedCredential");
101 }
102 return null;
103 }
104 SslCredKey key = new SslCredKey(thumbPrint, (int)sslProtocols, isServer, encryptionPolicy);
105 SafeFreeCredentials cachedCredential = GetCachedCredential(key);
106 if (cachedCredential == null || cachedCredential.IsClosed || cachedCredential.IsInvalid)
107 {
108 if (System.Net.NetEventSource.Log.IsEnabled())
109 {
110 System.Net.NetEventSource.Info(null, $"Not found or invalid, Current Cache Coun = {s_cachedCreds.Count}", "TryCachedCredential");
111 }
112 return null;
113 }
114 if (System.Net.NetEventSource.Log.IsEnabled())
115 {
116 System.Net.NetEventSource.Info(null, $"Found a cached Handle = {cachedCredential}", "TryCachedCredential");
117 }
118 return cachedCredential;
119 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static readonly ConcurrentDictionary< SslCredKey, SafeCredentialReference > s_cachedCreds
static SafeFreeCredentials GetCachedCredential(SslCredKey key)

References System.Net.Security.SslSessionsCache.GetCachedCredential(), System.Net.NetEventSource.Info(), System.key, System.Net.NetEventSource.Log, and System.Net.Security.SslSessionsCache.s_cachedCreds.

Referenced by System.Net.Security.SecureChannel.AcquireClientCredentials(), and System.Net.Security.SecureChannel.AcquireServerCredentials().