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
- mda.cs
- Message.cs
- LocationFactory.cs
- ProcessHost.cs
- CollectionConverter.cs
- BufferedReceiveManager.cs
- TextRange.cs
- Completion.cs
- TemplateControlParser.cs
- ToolStripOverflowButton.cs
- FormDocumentDesigner.cs
- EnumerableCollectionView.cs
- ValidationRule.cs
- Rotation3D.cs
- ListView.cs
- ObjectSelectorEditor.cs
- PluralizationServiceUtil.cs
- WorkflowDebuggerSteppingAttribute.cs
- Solver.cs
- MultiAsyncResult.cs
- TogglePattern.cs
- GPRECT.cs
- Shape.cs
- TimelineClockCollection.cs
- SymbolTable.cs
- SplashScreenNativeMethods.cs
- TrustManager.cs
- EntityProviderFactory.cs
- DockProviderWrapper.cs
- HotSpotCollection.cs
- CheckBoxStandardAdapter.cs
- unsafenativemethodsother.cs
- ClientUrlResolverWrapper.cs
- ResourcePermissionBase.cs
- IsolationInterop.cs
- SqlIdentifier.cs
- Inline.cs
- PerfCounters.cs
- FileLogRecordStream.cs
- ThreadExceptionEvent.cs
- ImageEditor.cs
- Root.cs
- CryptoApi.cs
- InvalidateEvent.cs
- GreenMethods.cs
- MarkupCompiler.cs
- LayoutEvent.cs
- PropertyValueChangedEvent.cs
- TemplateLookupAction.cs
- MediaTimeline.cs
- InheritablePropertyChangeInfo.cs
- RadioButton.cs
- ObjectDataSourceView.cs
- CompilerState.cs
- RemoteAsymmetricSignatureFormatter.cs
- MatrixIndependentAnimationStorage.cs
- CreateUserWizard.cs
- FixedSOMPageElement.cs
- Attributes.cs
- PipelineComponent.cs
- InputBinding.cs
- JsonReader.cs
- QilXmlReader.cs
- FigureParaClient.cs
- HttpListenerRequest.cs
- TimeoutHelper.cs
- AuthorizationRule.cs
- Calendar.cs
- RoleGroupCollection.cs
- MailDefinitionBodyFileNameEditor.cs
- XNameConverter.cs
- TextEncodedRawTextWriter.cs
- OutputCacheSettingsSection.cs
- WsdlParser.cs
- ClientProxyGenerator.cs
- XmlnsPrefixAttribute.cs
- ToolStripItemCollection.cs
- DispatcherFrame.cs
- FixUpCollection.cs
- SqlConnectionHelper.cs
- FixedNode.cs
- SqlCachedBuffer.cs
- LateBoundBitmapDecoder.cs
- TagMapInfo.cs
- FocusChangedEventArgs.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- Validator.cs
- MultiSelector.cs
- GPPOINT.cs
- MailMessageEventArgs.cs
- ScriptManagerProxy.cs
- WsdlInspector.cs
- CommandLineParser.cs
- TableLayoutColumnStyleCollection.cs
- FontEmbeddingManager.cs
- TextTreeTextBlock.cs
- DataGridViewUtilities.cs
- PrintDialog.cs
- ConfigurationPermission.cs
- MatcherBuilder.cs