Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SQlBooleanStorage.cs
- TextTreeTextBlock.cs
- Tag.cs
- ViewManagerAttribute.cs
- DbProviderConfigurationHandler.cs
- StylusPointDescription.cs
- latinshape.cs
- Parameter.cs
- EventSetter.cs
- ClientClassGenerator.cs
- SecurityState.cs
- EventDescriptor.cs
- WindowsGraphics2.cs
- altserialization.cs
- WSHttpSecurity.cs
- CodeBlockBuilder.cs
- Operators.cs
- ClientUtils.cs
- DebugInfo.cs
- MetadataImporter.cs
- LayoutUtils.cs
- DocumentAutomationPeer.cs
- Expression.DebuggerProxy.cs
- PathSegment.cs
- Blend.cs
- PriorityBindingExpression.cs
- HTMLTagNameToTypeMapper.cs
- EnumUnknown.cs
- Track.cs
- DataContext.cs
- RawKeyboardInputReport.cs
- ShapingEngine.cs
- _FtpControlStream.cs
- MaterialGroup.cs
- RegexCaptureCollection.cs
- FactorySettingsElement.cs
- RequestCachePolicyConverter.cs
- XmlSubtreeReader.cs
- DataGridViewAccessibleObject.cs
- ScriptingProfileServiceSection.cs
- CompositeCollection.cs
- ConsumerConnectionPoint.cs
- _NetRes.cs
- PrinterResolution.cs
- TextRange.cs
- DataMemberFieldConverter.cs
- X509ImageLogo.cs
- XmlDocumentType.cs
- Certificate.cs
- HostingEnvironmentException.cs
- EmbossBitmapEffect.cs
- Variant.cs
- ELinqQueryState.cs
- VectorCollectionConverter.cs
- SqlDelegatedTransaction.cs
- OrderByBuilder.cs
- IWorkflowDebuggerService.cs
- BasicExpressionVisitor.cs
- ObjectDataSourceDisposingEventArgs.cs
- EntityDataSourceWrapperCollection.cs
- TextFormatter.cs
- ServicePointManager.cs
- ElementHostPropertyMap.cs
- SchemaCollectionCompiler.cs
- Site.cs
- hwndwrapper.cs
- IgnoreFlushAndCloseStream.cs
- LockedActivityGlyph.cs
- GridViewColumnHeader.cs
- Column.cs
- EventTask.cs
- CompoundFileStorageReference.cs
- AmbiguousMatchException.cs
- TaskFactory.cs
- EllipticalNodeOperations.cs
- EntityViewGenerationAttribute.cs
- ProviderCollection.cs
- KeyValuePair.cs
- DeobfuscatingStream.cs
- TextFormatter.cs
- NavigationHelper.cs
- AnnotationHelper.cs
- MetadataImporterQuotas.cs
- TextTreeUndo.cs
- WebPartTransformerCollection.cs
- ConfigurationStrings.cs
- PriorityQueue.cs
- IndentedTextWriter.cs
- XmlSchemaSimpleTypeUnion.cs
- ObjectFullSpanRewriter.cs
- SchemaAttDef.cs
- OdbcCommand.cs
- EventManager.cs
- XmlUtf8RawTextWriter.cs
- DbSourceCommand.cs
- RelatedView.cs
- InputBindingCollection.cs
- NamespaceCollection.cs
- DataGridTablesFactory.cs
- Expression.cs