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
- LabelEditEvent.cs
- TableLayoutPanelCellPosition.cs
- WmlTextBoxAdapter.cs
- AssemblyUtil.cs
- Font.cs
- WebConfigurationManager.cs
- ResourceExpression.cs
- WindowsTokenRoleProvider.cs
- HitTestResult.cs
- DockPattern.cs
- AttributeEmitter.cs
- _emptywebproxy.cs
- AutomationElementCollection.cs
- SpnEndpointIdentityExtension.cs
- CrossSiteScriptingValidation.cs
- ObjectStateEntry.cs
- AutoGeneratedField.cs
- ProofTokenCryptoHandle.cs
- _ScatterGatherBuffers.cs
- BamlResourceDeserializer.cs
- DynamicActivityProperty.cs
- PagesSection.cs
- ItemAutomationPeer.cs
- BoolExpr.cs
- HelloOperationCD1AsyncResult.cs
- IgnorePropertiesAttribute.cs
- IntSecurity.cs
- Timer.cs
- IntegerValidator.cs
- StyleSheetComponentEditor.cs
- XmlSerializerOperationBehavior.cs
- X509Extension.cs
- Context.cs
- FileAuthorizationModule.cs
- WeakRefEnumerator.cs
- coordinator.cs
- SqlDependencyListener.cs
- CopyOnWriteList.cs
- DbProviderSpecificTypePropertyAttribute.cs
- BidirectionalDictionary.cs
- CursorConverter.cs
- DocumentManager.cs
- querybuilder.cs
- DecoderFallbackWithFailureFlag.cs
- sqlpipe.cs
- DoubleAnimationUsingKeyFrames.cs
- NativeMethods.cs
- ConfigurationElement.cs
- ContractInferenceHelper.cs
- AppDomainManager.cs
- TypeSystemProvider.cs
- SimpleExpression.cs
- WeakReferenceList.cs
- CurrentChangedEventManager.cs
- DurableInstanceProvider.cs
- Pair.cs
- ClientCultureInfo.cs
- ActivityDesignerLayoutSerializers.cs
- NumericUpDownAccelerationCollection.cs
- PerformanceCounterPermissionAttribute.cs
- InternalRelationshipCollection.cs
- RequestCacheEntry.cs
- CodeTypeDeclaration.cs
- BamlLocalizableResourceKey.cs
- BmpBitmapDecoder.cs
- XmlSerializerSection.cs
- BufferedWebEventProvider.cs
- AddInProcess.cs
- ListViewInsertionMark.cs
- Opcode.cs
- HttpWebRequestElement.cs
- AmbientValueAttribute.cs
- DbConnectionInternal.cs
- SharedConnectionListener.cs
- NamedPipeTransportManager.cs
- ThreadExceptionEvent.cs
- InfoCardListRequest.cs
- CompositeFontInfo.cs
- _NegoState.cs
- PassportAuthentication.cs
- HttpCapabilitiesBase.cs
- WebPartCollection.cs
- TextPattern.cs
- CurrentChangingEventArgs.cs
- StyleCollection.cs
- messageonlyhwndwrapper.cs
- TypeBrowser.xaml.cs
- TargetControlTypeAttribute.cs
- SwitchAttribute.cs
- DeploymentSectionCache.cs
- HwndProxyElementProvider.cs
- XmlElementAttribute.cs
- path.cs
- HttpApplicationFactory.cs
- DebugView.cs
- StreamGeometryContext.cs
- ColorPalette.cs
- Transform3DGroup.cs
- DecimalKeyFrameCollection.cs
- CodeAttributeArgument.cs