Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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()); } } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _ScatterGatherBuffers.cs
- WindowsGraphics.cs
- RoleManagerEventArgs.cs
- DispatchOperationRuntime.cs
- StringSource.cs
- TrackBarRenderer.cs
- FilteredAttributeCollection.cs
- RouteItem.cs
- EntityContainer.cs
- InvalidOperationException.cs
- BooleanConverter.cs
- DoWorkEventArgs.cs
- MsmqReceiveHelper.cs
- PageCatalogPart.cs
- TraceSwitch.cs
- InkCanvasSelectionAdorner.cs
- WriteableBitmap.cs
- Win32SafeHandles.cs
- ValidationSummary.cs
- Misc.cs
- LineServices.cs
- ListBox.cs
- UnmanagedHandle.cs
- DefaultMemberAttribute.cs
- XmlIncludeAttribute.cs
- XPathAxisIterator.cs
- DrawingAttributeSerializer.cs
- SqlFunctionAttribute.cs
- SelectedCellsCollection.cs
- UrlPath.cs
- GrammarBuilderWildcard.cs
- CodeBinaryOperatorExpression.cs
- ClassData.cs
- Decoder.cs
- Mutex.cs
- UnsignedPublishLicense.cs
- ControlEvent.cs
- MetadataCache.cs
- SmiRecordBuffer.cs
- SoapParser.cs
- Span.cs
- FilteredXmlReader.cs
- CompiledRegexRunner.cs
- AdPostCacheSubstitution.cs
- CriticalExceptions.cs
- MergeFailedEvent.cs
- ParamArrayAttribute.cs
- SHA512Managed.cs
- ICspAsymmetricAlgorithm.cs
- SafePointer.cs
- Underline.cs
- ComponentCollection.cs
- DynamicMetaObjectBinder.cs
- FixedHyperLink.cs
- DataSourceView.cs
- AutoGeneratedFieldProperties.cs
- MailMessage.cs
- ZoomingMessageFilter.cs
- RequiredFieldValidator.cs
- InvalidComObjectException.cs
- DataGridViewLayoutData.cs
- ReadOnlyPropertyMetadata.cs
- StrokeCollectionConverter.cs
- ShortcutKeysEditor.cs
- TripleDES.cs
- WebGetAttribute.cs
- BamlLocalizationDictionary.cs
- FormsAuthenticationCredentials.cs
- NotifyParentPropertyAttribute.cs
- ToolStripPanelRenderEventArgs.cs
- TextureBrush.cs
- ApplicationDirectory.cs
- FileLevelControlBuilderAttribute.cs
- OleDbErrorCollection.cs
- ThemeDictionaryExtension.cs
- GroupBox.cs
- RectAnimationBase.cs
- ImageField.cs
- ObjectDataSourceDesigner.cs
- HttpModuleCollection.cs
- RadioButtonFlatAdapter.cs
- GeneralTransform3DTo2DTo3D.cs
- EncodingDataItem.cs
- hwndwrapper.cs
- CustomAttributeSerializer.cs
- TextTreeFixupNode.cs
- XmlResolver.cs
- QueuePathDialog.cs
- XsltOutput.cs
- MasterPageBuildProvider.cs
- Privilege.cs
- StoryFragments.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- BadImageFormatException.cs
- TreeViewImageIndexConverter.cs
- TemplatedMailWebEventProvider.cs
- SignatureHelper.cs
- AssociationTypeEmitter.cs
- XmlAggregates.cs
- WebPartEditorOkVerb.cs