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
- Panel.cs
- VectorAnimationUsingKeyFrames.cs
- RowTypeElement.cs
- TypedElement.cs
- UTF8Encoding.cs
- LinqDataSourceStatusEventArgs.cs
- ContextStack.cs
- ellipse.cs
- FrameAutomationPeer.cs
- Menu.cs
- Int16.cs
- SoapElementAttribute.cs
- ReplyChannel.cs
- DesignerVerbToolStripMenuItem.cs
- BindingContext.cs
- ChangeInterceptorAttribute.cs
- PtsPage.cs
- SqlVersion.cs
- OuterGlowBitmapEffect.cs
- GestureRecognizer.cs
- ErrorEventArgs.cs
- SiteIdentityPermission.cs
- HttpListenerElement.cs
- ComplexBindingPropertiesAttribute.cs
- ProxyWebPart.cs
- DateTimeValueSerializerContext.cs
- InkCanvasFeedbackAdorner.cs
- AuthorizationRuleCollection.cs
- ThrowOnMultipleAssignment.cs
- SQLMoney.cs
- PersonalizableTypeEntry.cs
- UserControlBuildProvider.cs
- StateDesignerConnector.cs
- DataObjectPastingEventArgs.cs
- BoolExpressionVisitors.cs
- StyleSelector.cs
- InvalidCastException.cs
- __ConsoleStream.cs
- EndOfStreamException.cs
- ParameterCollection.cs
- CurrentChangingEventManager.cs
- SspiNegotiationTokenAuthenticator.cs
- DataViewSettingCollection.cs
- UserControlCodeDomTreeGenerator.cs
- MailWebEventProvider.cs
- HttpEncoder.cs
- SqlErrorCollection.cs
- OperationPerformanceCounters.cs
- ApplicationSecurityInfo.cs
- ObjectStateFormatter.cs
- WindowsGrip.cs
- StringKeyFrameCollection.cs
- ContainerUIElement3D.cs
- ApplicationTrust.cs
- ValidationSummary.cs
- RootBrowserWindow.cs
- ReflectionPermission.cs
- SecurityResources.cs
- ListViewDesigner.cs
- ValueTable.cs
- SchemaNames.cs
- Avt.cs
- ResourcePermissionBase.cs
- SqlDependency.cs
- OracleException.cs
- TransactionManager.cs
- querybuilder.cs
- FileSystemWatcher.cs
- Menu.cs
- CorrelationTokenInvalidatedHandler.cs
- AspCompat.cs
- TextProperties.cs
- _SecureChannel.cs
- SmtpException.cs
- COSERVERINFO.cs
- MethodImplAttribute.cs
- GeneralTransformGroup.cs
- RegexCharClass.cs
- DBSqlParserTableCollection.cs
- WebPartConnectionsDisconnectVerb.cs
- TemplateInstanceAttribute.cs
- LinqDataSourceSelectEventArgs.cs
- Sequence.cs
- UniqueEventHelper.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- MethodBuilderInstantiation.cs
- ExceptionHelpers.cs
- BamlLocalizationDictionary.cs
- Stackframe.cs
- SqlConnectionPoolGroupProviderInfo.cs
- NonBatchDirectoryCompiler.cs
- ControlBuilder.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- DataContractFormatAttribute.cs
- StringUtil.cs
- SqlHelper.cs
- Dynamic.cs
- CodeBlockBuilder.cs
- SelectionPatternIdentifiers.cs
- NameNode.cs