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
- CompilerGlobalScopeAttribute.cs
- BitmapEffectDrawingContent.cs
- LicFileLicenseProvider.cs
- ServicesUtilities.cs
- Deserializer.cs
- TypeExtensions.cs
- NativeMethods.cs
- TextSearch.cs
- CheckBoxFlatAdapter.cs
- RotateTransform3D.cs
- DataGridViewMethods.cs
- Emitter.cs
- CqlLexerHelpers.cs
- MimeTypeAttribute.cs
- ComboBox.cs
- ResourceIDHelper.cs
- StretchValidation.cs
- TraversalRequest.cs
- CodeTypeParameter.cs
- DataSvcMapFileSerializer.cs
- XmlDictionary.cs
- ContentValidator.cs
- Misc.cs
- ImageClickEventArgs.cs
- AnimationClockResource.cs
- InstanceDataCollectionCollection.cs
- fixedPageContentExtractor.cs
- translator.cs
- InlineUIContainer.cs
- BrowserDefinitionCollection.cs
- ResourcePermissionBaseEntry.cs
- GPStream.cs
- FaultCallbackWrapper.cs
- GetTokenRequest.cs
- DataKey.cs
- ClientRuntimeConfig.cs
- SwitchElementsCollection.cs
- ArgumentOutOfRangeException.cs
- CheckBox.cs
- SizeValueSerializer.cs
- CustomCredentialPolicy.cs
- WebAdminConfigurationHelper.cs
- Atom10ItemFormatter.cs
- InternalSendMessage.cs
- XmlName.cs
- PackUriHelper.cs
- DBSqlParserColumn.cs
- TextShapeableCharacters.cs
- ZeroOpNode.cs
- ActivityCodeDomSerializationManager.cs
- SmiEventSink.cs
- LayoutEvent.cs
- GregorianCalendarHelper.cs
- WebEventCodes.cs
- AsymmetricAlgorithm.cs
- PropertyInformation.cs
- TabRenderer.cs
- SqlCommandSet.cs
- DataMemberFieldEditor.cs
- LinkedList.cs
- GenericUriParser.cs
- ActivityValidationServices.cs
- EventWaitHandle.cs
- PageThemeCodeDomTreeGenerator.cs
- OracleFactory.cs
- PropertyManager.cs
- WriteTimeStream.cs
- ReachPageContentSerializerAsync.cs
- PortCache.cs
- CollectionViewProxy.cs
- DataSourceCacheDurationConverter.cs
- HttpDebugHandler.cs
- ContextMenuAutomationPeer.cs
- ArrangedElement.cs
- TrackingDataItem.cs
- TextBlock.cs
- ValidatingReaderNodeData.cs
- SettingsPropertyNotFoundException.cs
- CompilerScopeManager.cs
- DesignOnlyAttribute.cs
- RepeaterItem.cs
- MetricEntry.cs
- BinHexEncoder.cs
- DateTimeUtil.cs
- WrappedIUnknown.cs
- XmlWriter.cs
- VectorConverter.cs
- MonitoringDescriptionAttribute.cs
- Repeater.cs
- XmlNodeChangedEventArgs.cs
- XPathDocumentNavigator.cs
- ContextBase.cs
- MimeMapping.cs
- EventlogProvider.cs
- Enum.cs
- PropertyChangedEventArgs.cs
- SecurityTokenValidationException.cs
- EmptyElement.cs
- NativeMethods.cs
- ToolStripItemRenderEventArgs.cs