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
- WindowsListView.cs
- ExceptQueryOperator.cs
- WebBaseEventKeyComparer.cs
- HostDesigntimeLicenseContext.cs
- RadioButtonBaseAdapter.cs
- CodeDOMProvider.cs
- InstanceNotFoundException.cs
- ExpressionLexer.cs
- StrongNameUtility.cs
- TimeSpanConverter.cs
- SizeChangedInfo.cs
- SchemaObjectWriter.cs
- RevocationPoint.cs
- TemplateControl.cs
- VisualTransition.cs
- Border.cs
- TableLayoutStyleCollection.cs
- Command.cs
- ChildTable.cs
- CreateUserWizardStep.cs
- InvalidCastException.cs
- SqlConnectionStringBuilder.cs
- SoapProcessingBehavior.cs
- EdmTypeAttribute.cs
- httpstaticobjectscollection.cs
- ServiceProviders.cs
- SchemaAttDef.cs
- ContentOperations.cs
- DragDrop.cs
- ZipIOFileItemStream.cs
- CoTaskMemHandle.cs
- EntityConnectionStringBuilderItem.cs
- GroupBox.cs
- precedingquery.cs
- DbConvert.cs
- _Events.cs
- AuthenticationManager.cs
- StrongNameKeyPair.cs
- AllMembershipCondition.cs
- RelationshipEnd.cs
- SafeLocalAllocation.cs
- PenCursorManager.cs
- PropertyMappingExceptionEventArgs.cs
- XamlSerializerUtil.cs
- TemplateControlBuildProvider.cs
- DeploymentSection.cs
- RefreshEventArgs.cs
- RuntimeHandles.cs
- PropertyConverter.cs
- RequestCacheManager.cs
- SeparatorAutomationPeer.cs
- PathTooLongException.cs
- ConfigurationValue.cs
- VerticalAlignConverter.cs
- KeyGesture.cs
- SoapCodeExporter.cs
- WorkflowMessageEventArgs.cs
- AffineTransform3D.cs
- WorkflowServiceNamespace.cs
- EventProxy.cs
- FontDialog.cs
- TextServicesPropertyRanges.cs
- AnimatedTypeHelpers.cs
- UpdatePanelTriggerCollection.cs
- Brush.cs
- DynamicMetaObject.cs
- HtmlMeta.cs
- X509ScopedServiceCertificateElement.cs
- DBDataPermissionAttribute.cs
- ThreadStaticAttribute.cs
- HttpMethodConstraint.cs
- WorkflowItemsPresenter.cs
- ExpiredSecurityTokenException.cs
- WebPartsPersonalization.cs
- LinqDataSourceDeleteEventArgs.cs
- NavigationFailedEventArgs.cs
- WorkflowViewService.cs
- HtmlInputControl.cs
- XmlSchemaSimpleTypeUnion.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- DataGridViewCellLinkedList.cs
- QilGenerator.cs
- EditModeSwitchButton.cs
- LongValidator.cs
- ColumnReorderedEventArgs.cs
- RotateTransform.cs
- Throw.cs
- SvcMapFileLoader.cs
- MessageBox.cs
- SessionEndingCancelEventArgs.cs
- DirectoryObjectSecurity.cs
- DbConnectionHelper.cs
- PseudoWebRequest.cs
- RawStylusSystemGestureInputReport.cs
- BitmapDecoder.cs
- FlowPosition.cs
- RangeValidator.cs
- TextContainerHelper.cs
- InstanceData.cs
- XmlHierarchyData.cs