Commit cf0ae5e6 cf0ae5e630707640609ef90ff1b21ff6077a2fc1 by Christian Gerdes

Added more thread safty to ClearSSLSessions

Now it should be safe to use even if another thread is in the middle of storing a session before we disable it.
1 parent 2276a81d
......@@ -75,6 +75,7 @@ namespace LIL_VSTT_Plugins
System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(System.Net.Security.SslStream));
Type t = asm.GetType("System.Net.Security.SslSessionsCache");
System.Reflection.FieldInfo f = t.GetField("s_CachedCreds", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
lock (f.GetValue(null))
f.SetValue(null, new ZeroHashtable());
}
......@@ -83,6 +84,7 @@ namespace LIL_VSTT_Plugins
System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(System.Net.Security.SslStream));
Type t = asm.GetType("System.Net.Security.SslSessionsCache");
System.Reflection.FieldInfo f = t.GetField("s_CachedCreds", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
lock (f.GetValue(null))
f.SetValue(null, new System.Collections.Hashtable(32));
}
}
......