Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SchemaNamespaceManager.cs
- MiniLockedBorderGlyph.cs
- MobileFormsAuthentication.cs
- PageAction.cs
- Page.cs
- ISessionStateStore.cs
- FontDifferentiator.cs
- SqlDataSourceFilteringEventArgs.cs
- ProxyWebPart.cs
- QuestionEventArgs.cs
- LinqDataSourceEditData.cs
- HGlobalSafeHandle.cs
- DataGridBoolColumn.cs
- TextElementCollection.cs
- AnchoredBlock.cs
- ControlDesignerState.cs
- DESCryptoServiceProvider.cs
- FrameworkContentElementAutomationPeer.cs
- DocumentDesigner.cs
- Encoding.cs
- SchemaNames.cs
- UIntPtr.cs
- IncrementalReadDecoders.cs
- ConsumerConnectionPoint.cs
- ADMembershipUser.cs
- SetterBaseCollection.cs
- CommandEventArgs.cs
- ExtractedStateEntry.cs
- filewebrequest.cs
- MessageEnumerator.cs
- HybridDictionary.cs
- InlineCollection.cs
- BitmapData.cs
- MTConfigUtil.cs
- BaseTemplateBuildProvider.cs
- EventSinkHelperWriter.cs
- CacheMemory.cs
- SortKey.cs
- handlecollector.cs
- odbcmetadatacollectionnames.cs
- SHA512Managed.cs
- ComplexTypeEmitter.cs
- FreezableOperations.cs
- SHA1Cng.cs
- ColorKeyFrameCollection.cs
- ItemChangedEventArgs.cs
- CheckedPointers.cs
- WebProxyScriptElement.cs
- InstanceData.cs
- ConfigPathUtility.cs
- FunctionQuery.cs
- InternalBase.cs
- SqlReferenceCollection.cs
- ComponentCodeDomSerializer.cs
- GridViewSelectEventArgs.cs
- XmlSchemaObject.cs
- IteratorDescriptor.cs
- PointConverter.cs
- LayoutManager.cs
- PrintDialog.cs
- ParameterCollection.cs
- ProxyWebPartConnectionCollection.cs
- CreateDataSourceDialog.cs
- MenuItem.cs
- UrlMappingCollection.cs
- Transactions.cs
- AliasExpr.cs
- StylusPoint.cs
- EventToken.cs
- LogicalExpr.cs
- BaseCAMarshaler.cs
- HttpDictionary.cs
- HttpCacheVaryByContentEncodings.cs
- ContractMethodParameterInfo.cs
- DefaultAssemblyResolver.cs
- DocumentSequenceHighlightLayer.cs
- ExceptionHandlers.cs
- RepeatBehaviorConverter.cs
- LocalizabilityAttribute.cs
- CommandValueSerializer.cs
- SpnEndpointIdentity.cs
- SessionStateSection.cs
- XmlBinaryReader.cs
- OdbcException.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- XamlReaderHelper.cs
- SqlDataSourceFilteringEventArgs.cs
- InputProviderSite.cs
- updateconfighost.cs
- Container.cs
- ByteViewer.cs
- ZipIORawDataFileBlock.cs
- IpcManager.cs
- HttpCookiesSection.cs
- ChangePassword.cs
- NamespaceList.cs
- FileRecordSequenceCompletedAsyncResult.cs
- TagPrefixAttribute.cs
- RadioButton.cs
- AuditLogLocation.cs