Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / _SSPISessionCache.cs / 1 / _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
- ContextCorrelationInitializer.cs
- Accessible.cs
- ServiceMoniker.cs
- MultiSelector.cs
- ApplyImportsAction.cs
- XmlCDATASection.cs
- LinqDataSourceInsertEventArgs.cs
- HandleExceptionArgs.cs
- XmlDocumentSerializer.cs
- TextRange.cs
- propertytag.cs
- SecurityPermission.cs
- FocusChangedEventArgs.cs
- TemplateParser.cs
- AsymmetricKeyExchangeFormatter.cs
- DisposableCollectionWrapper.cs
- Trace.cs
- TabControlToolboxItem.cs
- SafeRegistryHandle.cs
- SingleSelectRootGridEntry.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- UnaryNode.cs
- BigInt.cs
- DbConnectionPoolGroup.cs
- IIS7WorkerRequest.cs
- DeclarativeCatalogPart.cs
- UnsafeNativeMethods.cs
- securitycriticaldata.cs
- WebColorConverter.cs
- InlineUIContainer.cs
- XsltArgumentList.cs
- ExceptionRoutedEventArgs.cs
- NativeMethodsOther.cs
- SelectorItemAutomationPeer.cs
- GuidTagList.cs
- DeviceContext.cs
- DecodeHelper.cs
- QueryInterceptorAttribute.cs
- COMException.cs
- SettingsPropertyNotFoundException.cs
- WebPartDescriptionCollection.cs
- SQLBytes.cs
- FormViewRow.cs
- IntPtr.cs
- ModuleElement.cs
- DispatcherHooks.cs
- MenuItemCollection.cs
- AppAction.cs
- wgx_render.cs
- WmlSelectionListAdapter.cs
- X509Chain.cs
- TransformGroup.cs
- PropertyMapper.cs
- XmlSchemaImport.cs
- entityreference_tresulttype.cs
- ItemCheckedEvent.cs
- TableColumn.cs
- ConditionalWeakTable.cs
- FileDataSourceCache.cs
- XmlTypeAttribute.cs
- AttributeConverter.cs
- FileDialog_Vista_Interop.cs
- BitmapEditor.cs
- XmlQueryContext.cs
- EnumerableRowCollectionExtensions.cs
- GacUtil.cs
- XmlNamespaceMapping.cs
- HtmlHistory.cs
- ProfileSettings.cs
- NameTable.cs
- TextBreakpoint.cs
- SerializationFieldInfo.cs
- ModelUIElement3D.cs
- ObjectQueryState.cs
- Type.cs
- SEHException.cs
- SmiTypedGetterSetter.cs
- TableLayoutRowStyleCollection.cs
- ExceptionRoutedEventArgs.cs
- ContextStack.cs
- WmlSelectionListAdapter.cs
- unsafenativemethodstextservices.cs
- SemanticResolver.cs
- OdbcTransaction.cs
- isolationinterop.cs
- OleDbFactory.cs
- ReadContentAsBinaryHelper.cs
- ButtonBaseAdapter.cs
- XPathAncestorQuery.cs
- SamlAssertionKeyIdentifierClause.cs
- EdmEntityTypeAttribute.cs
- ToolStripHighContrastRenderer.cs
- UIElement.cs
- HashSet.cs
- DefaultTextStore.cs
- ObjectDataSourceEventArgs.cs
- Table.cs
- AnnouncementClient.cs
- WebZone.cs
- CurrencyWrapper.cs