Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SignatureToken.cs
- GridEntry.cs
- BaseTemplateBuildProvider.cs
- Duration.cs
- PerformanceCounterManager.cs
- CssClassPropertyAttribute.cs
- CryptoConfig.cs
- ChameleonKey.cs
- PropertyGroupDescription.cs
- XmlSerializerAssemblyAttribute.cs
- Convert.cs
- HttpListenerContext.cs
- TableLayoutCellPaintEventArgs.cs
- InitializationEventAttribute.cs
- PartialTrustHelpers.cs
- WebPartMenu.cs
- InstanceDataCollection.cs
- Int16.cs
- Memoizer.cs
- wgx_commands.cs
- EntityDataSourceStatementEditor.cs
- XmlArrayItemAttribute.cs
- CommandEventArgs.cs
- MenuBindingsEditorForm.cs
- MouseEventArgs.cs
- TextInfo.cs
- FileIOPermission.cs
- HttpRawResponse.cs
- ConfigXmlText.cs
- WebHostScriptMappingsInstallComponent.cs
- FlowchartSizeFeature.cs
- CommandConverter.cs
- QilValidationVisitor.cs
- TaskFactory.cs
- TraceUtility.cs
- NotCondition.cs
- StringUtil.cs
- EnumMemberAttribute.cs
- SQLMoney.cs
- ScriptingSectionGroup.cs
- XPathParser.cs
- _KerberosClient.cs
- ToolboxItem.cs
- TextParaClient.cs
- TypeElement.cs
- FocusManager.cs
- ScrollBarAutomationPeer.cs
- IndexedEnumerable.cs
- _WinHttpWebProxyDataBuilder.cs
- DbSourceParameterCollection.cs
- ColorMatrix.cs
- LinqDataSourceView.cs
- DynamicVirtualDiscoSearcher.cs
- RegexCompiler.cs
- XslAst.cs
- SelectionRange.cs
- LocalBuilder.cs
- PeerTransportCredentialType.cs
- WebPartConnectionsEventArgs.cs
- BitmapPalettes.cs
- SafeFileMappingHandle.cs
- UrlMappingsSection.cs
- ServiceHttpModule.cs
- WebPartCatalogAddVerb.cs
- DataServiceResponse.cs
- CollectionDataContractAttribute.cs
- Baml2006ReaderContext.cs
- URLIdentityPermission.cs
- XmlReader.cs
- BinaryObjectWriter.cs
- TreeNodeBinding.cs
- APCustomTypeDescriptor.cs
- DocumentSchemaValidator.cs
- XmlAttributeCollection.cs
- UnsafeNativeMethods.cs
- SHA1CryptoServiceProvider.cs
- DataGridLengthConverter.cs
- Viewport2DVisual3D.cs
- PerspectiveCamera.cs
- CopyEncoder.cs
- TrackingSection.cs
- SendMessageContent.cs
- BitmapCodecInfo.cs
- MonitorWrapper.cs
- CompositeDataBoundControl.cs
- TargetControlTypeAttribute.cs
- XmlSchemaAny.cs
- ChannelOptions.cs
- TemplateBindingExtension.cs
- AccessedThroughPropertyAttribute.cs
- ColorMatrix.cs
- ModulesEntry.cs
- DiagnosticStrings.cs
- TextBoxView.cs
- LinqToSqlWrapper.cs
- InvalidPropValue.cs
- TimeSpanMinutesConverter.cs
- ToolboxSnapDragDropEventArgs.cs
- URLString.cs
- DataKey.cs