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
- SqlInternalConnectionSmi.cs
- BypassElementCollection.cs
- EncryptedPackageFilter.cs
- CompensatableSequenceActivity.cs
- Config.cs
- WindowsRichEditRange.cs
- GlobalEventManager.cs
- hwndwrapper.cs
- ProcessThread.cs
- MetadataArtifactLoaderFile.cs
- InvokeGenerator.cs
- TabItem.cs
- AttributeProviderAttribute.cs
- AdornerDecorator.cs
- DeploymentSectionCache.cs
- DocumentApplicationState.cs
- _SafeNetHandles.cs
- ToolStripItemCollection.cs
- SchemaImporterExtensionElement.cs
- CodeGenHelper.cs
- XmlSchemaCollection.cs
- NewArrayExpression.cs
- ContentValidator.cs
- RegexWorker.cs
- ScrollViewerAutomationPeer.cs
- VectorAnimation.cs
- ToolStripGripRenderEventArgs.cs
- SqlClientPermission.cs
- SchemaInfo.cs
- ServiceThrottlingBehavior.cs
- WindowsSlider.cs
- FormView.cs
- BindingExpressionBase.cs
- ObjectIDGenerator.cs
- AssemblyBuilder.cs
- XmlILStorageConverter.cs
- InvokeGenerator.cs
- TreePrinter.cs
- DataServiceResponse.cs
- ButtonBase.cs
- SapiAttributeParser.cs
- MediaEntryAttribute.cs
- MailDefinition.cs
- HashAlgorithm.cs
- ImageCodecInfoPrivate.cs
- XmlSchemaSubstitutionGroup.cs
- DataGridTableCollection.cs
- SerialReceived.cs
- TraceLog.cs
- ReferentialConstraint.cs
- JsonReader.cs
- ApplicationFileCodeDomTreeGenerator.cs
- XamlInterfaces.cs
- PenLineCapValidation.cs
- StorageAssociationTypeMapping.cs
- StructuralType.cs
- WebPartActionVerb.cs
- versioninfo.cs
- AppDomainUnloadedException.cs
- InputReport.cs
- ApplicationId.cs
- IISMapPath.cs
- ShutDownListener.cs
- DBDataPermissionAttribute.cs
- Size.cs
- StringFunctions.cs
- CollectionsUtil.cs
- StorageRoot.cs
- DSASignatureDeformatter.cs
- ComponentChangingEvent.cs
- Crc32.cs
- FixedFindEngine.cs
- WebSysDisplayNameAttribute.cs
- Rijndael.cs
- WebPartZoneDesigner.cs
- MemoryRecordBuffer.cs
- ReaderWriterLockSlim.cs
- StoryFragments.cs
- ArrowControl.xaml.cs
- ObjectKeyFrameCollection.cs
- CommandBinding.cs
- RightsManagementResourceHelper.cs
- TableCellsCollectionEditor.cs
- AttributeProviderAttribute.cs
- StorageMappingItemLoader.cs
- NamespaceQuery.cs
- DefaultProxySection.cs
- CmsInterop.cs
- FlowLayoutPanel.cs
- FacetChecker.cs
- ShapeTypeface.cs
- XmlAttributeOverrides.cs
- ParentQuery.cs
- SchemaComplexType.cs
- ADMembershipUser.cs
- RoleManagerSection.cs
- ConnectionStringsSection.cs
- NetworkInformationPermission.cs
- OleDbRowUpdatedEvent.cs
- WhereQueryOperator.cs