Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / _SSPISessionCache.cs / 1305376 / _SSPISessionCache.cs
/*++ Copyright (c) Microsoft Corporation Module Name: _SspiSessionCache.cs Abstract: The file implements trivial SSPI credential caching mechanism based on lru list Author: Alexei Vopilov 20-Oct-2004 Revision History: --*/ namespace System.Net.Security { using System.Net; using System.Threading; using System.Collections; // // Implements delayed SSPI handle release, like a finalizable object though the handles are kept alive until being pushed out // by the newly incoming ones. // internal static class SSPIHandleCache { private const int c_MaxCacheSize = 0x1F; // must a (power of 2) - 1 private static SafeCredentialReference[] _CacheSlots = new SafeCredentialReference[c_MaxCacheSize+1]; private static int _Current = -1; internal static void CacheCredential(SafeFreeCredentials newHandle) { try { SafeCredentialReference newRef = SafeCredentialReference.CreateReference(newHandle); if (newRef == null) return; unchecked { int index = Interlocked.Increment(ref _Current) & c_MaxCacheSize; newRef = Interlocked.Exchange(ref _CacheSlots[index], newRef); } if (newRef != null) newRef.Close(); } catch(Exception e) { if (!NclUtilities.IsFatal(e)){ GlobalLog.Assert("SSPIHandlCache", "Attempted to throw: " + e.ToString()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /*++ Copyright (c) Microsoft Corporation Module Name: _SspiSessionCache.cs Abstract: The file implements trivial SSPI credential caching mechanism based on lru list Author: Alexei Vopilov 20-Oct-2004 Revision History: --*/ namespace System.Net.Security { using System.Net; using System.Threading; using System.Collections; // // Implements delayed SSPI handle release, like a finalizable object though the handles are kept alive until being pushed out // by the newly incoming ones. // internal static class SSPIHandleCache { private const int c_MaxCacheSize = 0x1F; // must a (power of 2) - 1 private static SafeCredentialReference[] _CacheSlots = new SafeCredentialReference[c_MaxCacheSize+1]; private static int _Current = -1; internal static void CacheCredential(SafeFreeCredentials newHandle) { try { SafeCredentialReference newRef = SafeCredentialReference.CreateReference(newHandle); if (newRef == null) return; unchecked { int index = Interlocked.Increment(ref _Current) & c_MaxCacheSize; newRef = Interlocked.Exchange (ref _CacheSlots[index], newRef); } if (newRef != null) newRef.Close(); } catch(Exception e) { if (!NclUtilities.IsFatal(e)){ GlobalLog.Assert("SSPIHandlCache", "Attempted to throw: " + e.ToString()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FontFamilyIdentifier.cs
- _UriSyntax.cs
- BrowserCapabilitiesFactory.cs
- IndividualDeviceConfig.cs
- FusionWrap.cs
- JsonQueryStringConverter.cs
- SqlMetaData.cs
- OdbcException.cs
- TemplateBaseAction.cs
- WindowsFormsHostPropertyMap.cs
- IncrementalReadDecoders.cs
- TrustLevelCollection.cs
- HttpPostClientProtocol.cs
- DataGridViewDesigner.cs
- RegistrationServices.cs
- Identity.cs
- XPathScanner.cs
- RepeatInfo.cs
- ListBase.cs
- Columns.cs
- FocusManager.cs
- OperationSelectorBehavior.cs
- Rect3D.cs
- HttpCapabilitiesBase.cs
- Array.cs
- MatrixUtil.cs
- CapabilitiesPattern.cs
- LinqDataView.cs
- VectorValueSerializer.cs
- Expander.cs
- AttributeExtensions.cs
- _SslStream.cs
- TimeEnumHelper.cs
- Point.cs
- FullTrustAssemblyCollection.cs
- XmlDomTextWriter.cs
- ObjectQueryState.cs
- MenuItemBindingCollection.cs
- Size.cs
- StringUtil.cs
- compensatingcollection.cs
- Rotation3D.cs
- StructuredTypeEmitter.cs
- backend.cs
- HtmlDocument.cs
- SerializerWriterEventHandlers.cs
- SmiXetterAccessMap.cs
- cache.cs
- ControlCollection.cs
- CodeSnippetExpression.cs
- XmlTextReaderImplHelpers.cs
- WebContext.cs
- dbdatarecord.cs
- UnsafeNativeMethods.cs
- ConstructorExpr.cs
- Timer.cs
- HttpStreamXmlDictionaryWriter.cs
- URIFormatException.cs
- CompareInfo.cs
- NGCPageContentCollectionSerializerAsync.cs
- _NetRes.cs
- NativeRecognizer.cs
- Binding.cs
- Control.cs
- _NegoStream.cs
- XpsS0ValidatingLoader.cs
- XmlSchemaSimpleContent.cs
- LogAppendAsyncResult.cs
- TypeElement.cs
- SafeLibraryHandle.cs
- TransformConverter.cs
- HttpGetProtocolImporter.cs
- GenericXmlSecurityToken.cs
- SqlRewriteScalarSubqueries.cs
- DateTimeConstantAttribute.cs
- BoundPropertyEntry.cs
- VirtualPathProvider.cs
- SqlNode.cs
- BitmapCache.cs
- XamlDesignerSerializationManager.cs
- SerializationInfoEnumerator.cs
- TableDesigner.cs
- OleDbCommand.cs
- XComponentModel.cs
- ResourceIDHelper.cs
- ListSourceHelper.cs
- RawKeyboardInputReport.cs
- HistoryEventArgs.cs
- DataRelationCollection.cs
- WindowsSecurityToken.cs
- SchemaNamespaceManager.cs
- ReadOnlyCollection.cs
- ToolStripItemEventArgs.cs
- HtmlMeta.cs
- CategoryNameCollection.cs
- InputLanguageSource.cs
- ComboBoxRenderer.cs
- Page.cs
- ObjectConverter.cs
- FolderBrowserDialogDesigner.cs