Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- HttpRequestCacheValidator.cs
- Section.cs
- ResourceExpressionEditor.cs
- CommandManager.cs
- PnrpPermission.cs
- StartUpEventArgs.cs
- DataStorage.cs
- CharacterHit.cs
- RemoteArgument.cs
- UriSchemeKeyedCollection.cs
- IDQuery.cs
- PointValueSerializer.cs
- ScrollProviderWrapper.cs
- TextRangeAdaptor.cs
- SelectorAutomationPeer.cs
- XomlDesignerLoader.cs
- SqlConnectionManager.cs
- Literal.cs
- PlatformNotSupportedException.cs
- ContextMenuStripGroupCollection.cs
- MsmqException.cs
- UrlMappingsModule.cs
- CompositeKey.cs
- ReadOnlyDataSourceView.cs
- WinEventWrap.cs
- DecimalStorage.cs
- ProfileManager.cs
- CaseKeyBox.ViewModel.cs
- PersonalizationStateInfo.cs
- TraceSwitch.cs
- CustomLineCap.cs
- ConstructorArgumentAttribute.cs
- KeyPullup.cs
- SelectionEditingBehavior.cs
- GridViewPageEventArgs.cs
- PathSegment.cs
- ErrorTableItemStyle.cs
- Brush.cs
- CheckBoxBaseAdapter.cs
- Privilege.cs
- NativeActivity.cs
- FocusTracker.cs
- ImportContext.cs
- XamlReader.cs
- RenderCapability.cs
- CommandLibraryHelper.cs
- NeutralResourcesLanguageAttribute.cs
- HttpCapabilitiesEvaluator.cs
- MediaContextNotificationWindow.cs
- TraceHwndHost.cs
- DesignUtil.cs
- ImageDrawing.cs
- DataGridViewComboBoxColumn.cs
- D3DImage.cs
- ExpandCollapseIsCheckedConverter.cs
- XmlStreamStore.cs
- RunInstallerAttribute.cs
- Visual3D.cs
- EditorZoneAutoFormat.cs
- ContourSegment.cs
- ToggleButton.cs
- CommentGlyph.cs
- Overlapped.cs
- SharedUtils.cs
- ExpressionBinding.cs
- ServicePointManager.cs
- ThousandthOfEmRealPoints.cs
- BindingEntityInfo.cs
- ShapingWorkspace.cs
- CodeAttributeArgument.cs
- AnonymousIdentificationSection.cs
- ReadWriteObjectLock.cs
- AutomationElement.cs
- SimpleWebHandlerParser.cs
- MessagingActivityHelper.cs
- CompressEmulationStream.cs
- Bits.cs
- MetricEntry.cs
- ServerIdentity.cs
- ListParagraph.cs
- PropertyOverridesTypeEditor.cs
- Buffer.cs
- AuthorizationRuleCollection.cs
- StringDictionaryEditor.cs
- StylusPointPropertyInfo.cs
- WeakReferenceKey.cs
- StyleBamlTreeBuilder.cs
- EntityDataSourceChangedEventArgs.cs
- HttpAsyncResult.cs
- KnownBoxes.cs
- GorillaCodec.cs
- SQLInt16Storage.cs
- LockCookie.cs
- XPathConvert.cs
- UnknownWrapper.cs
- CatalogZoneBase.cs
- SystemNetworkInterface.cs
- ScriptManagerProxy.cs
- LocalFileSettingsProvider.cs
- WindowsScroll.cs