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
- ITextView.cs
- BlockExpression.cs
- WinFormsUtils.cs
- DataGridCellEditEndingEventArgs.cs
- Win32.cs
- LocalClientSecuritySettingsElement.cs
- TraceSection.cs
- TimelineGroup.cs
- ProxyManager.cs
- CompositeFontFamily.cs
- WindowsAuthenticationModule.cs
- DetailsViewInsertEventArgs.cs
- XamlToRtfParser.cs
- DecoderReplacementFallback.cs
- PermissionToken.cs
- ScriptRegistrationManager.cs
- OleDbError.cs
- XmlEncoding.cs
- ProgressiveCrcCalculatingStream.cs
- WebEvents.cs
- NavigationService.cs
- AssemblyBuilder.cs
- PopOutPanel.cs
- cache.cs
- CodePageEncoding.cs
- XomlSerializationHelpers.cs
- DbConnectionPool.cs
- BlurEffect.cs
- DurationConverter.cs
- CacheVirtualItemsEvent.cs
- StringAnimationUsingKeyFrames.cs
- SqlRetyper.cs
- TextBoxLine.cs
- UnauthorizedAccessException.cs
- ArrayHelper.cs
- SqlAliasesReferenced.cs
- Size3DValueSerializer.cs
- PerformanceCounterPermissionAttribute.cs
- ZoneLinkButton.cs
- CommandTreeTypeHelper.cs
- EventDriven.cs
- CachingParameterInspector.cs
- OrthographicCamera.cs
- TracedNativeMethods.cs
- SortDescription.cs
- QilLiteral.cs
- XmlNode.cs
- Itemizer.cs
- IfJoinedCondition.cs
- X509RawDataKeyIdentifierClause.cs
- HtmlControlPersistable.cs
- CodeThrowExceptionStatement.cs
- _TransmitFileOverlappedAsyncResult.cs
- GradientBrush.cs
- ItemsChangedEventArgs.cs
- safelinkcollection.cs
- TransformerConfigurationWizardBase.cs
- HtmlInputPassword.cs
- Decoder.cs
- SqlAliaser.cs
- SharedPersonalizationStateInfo.cs
- CaseStatement.cs
- SolidBrush.cs
- PrivilegedConfigurationManager.cs
- RelatedEnd.cs
- MissingSatelliteAssemblyException.cs
- RelationshipDetailsRow.cs
- Vector.cs
- WSHttpTransportSecurityElement.cs
- WindowsGraphics2.cs
- GlyphRunDrawing.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- VariableQuery.cs
- ProviderConnectionPointCollection.cs
- CompatibleIComparer.cs
- MouseDevice.cs
- SafeEventHandle.cs
- Resources.Designer.cs
- ObjectDataSource.cs
- BulletedList.cs
- PropertyPathConverter.cs
- LabelEditEvent.cs
- MediaSystem.cs
- DataGridViewRowHeaderCell.cs
- CacheSection.cs
- exports.cs
- ErrorItem.cs
- Point.cs
- WebBrowser.cs
- PointConverter.cs
- TextParagraph.cs
- DefinitionBase.cs
- Lock.cs
- BitmapSource.cs
- HGlobalSafeHandle.cs
- DataGridViewCellValidatingEventArgs.cs
- ConfigXmlCDataSection.cs
- ScriptResourceMapping.cs
- DefaultSection.cs
- SizeIndependentAnimationStorage.cs