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
- StaticTextPointer.cs
- NavigationPropertyEmitter.cs
- ValuePattern.cs
- QueryExtender.cs
- WebPartEditorOkVerb.cs
- OpCellTreeNode.cs
- SettingsSection.cs
- HttpCookiesSection.cs
- VectorAnimationUsingKeyFrames.cs
- RotationValidation.cs
- DBPropSet.cs
- InteropBitmapSource.cs
- MarshalDirectiveException.cs
- BitmapPalettes.cs
- ParseChildrenAsPropertiesAttribute.cs
- Tuple.cs
- HttpModuleAction.cs
- DependencyObjectPropertyDescriptor.cs
- DependencyObjectType.cs
- StrokeNodeOperations.cs
- CodeBinaryOperatorExpression.cs
- UniqueIdentifierService.cs
- DataGridViewCellCancelEventArgs.cs
- UpdateCompiler.cs
- BindingMAnagerBase.cs
- DataBoundControl.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- MatrixAnimationBase.cs
- ImageClickEventArgs.cs
- OleDbConnectionFactory.cs
- ConfigurationValue.cs
- CopyNamespacesAction.cs
- TemplatePropertyEntry.cs
- EntryIndex.cs
- PathTooLongException.cs
- WebPartsPersonalizationAuthorization.cs
- SizeKeyFrameCollection.cs
- HandlerFactoryCache.cs
- ValidatorUtils.cs
- ExpressionBindingCollection.cs
- _HTTPDateParse.cs
- MachinePropertyVariants.cs
- Peer.cs
- RegisteredHiddenField.cs
- Html32TextWriter.cs
- Parser.cs
- BlurEffect.cs
- SqlFlattener.cs
- PageThemeBuildProvider.cs
- FormsIdentity.cs
- MeshGeometry3D.cs
- RoleGroup.cs
- NavigationProgressEventArgs.cs
- Sorting.cs
- XPathChildIterator.cs
- XmlSchemaSimpleContentExtension.cs
- OraclePermission.cs
- EntityCommandExecutionException.cs
- WebRequestModulesSection.cs
- SystemKeyConverter.cs
- RewritingPass.cs
- LinqDataSourceInsertEventArgs.cs
- SupportsEventValidationAttribute.cs
- AssemblyName.cs
- DataGridTableCollection.cs
- ResourceAssociationType.cs
- SeekableMessageNavigator.cs
- TextServicesLoader.cs
- EventHandlerService.cs
- HttpAsyncResult.cs
- ItemsControlAutomationPeer.cs
- SessionStateUtil.cs
- TerminatorSinks.cs
- ActivationService.cs
- VectorAnimationBase.cs
- DbConnectionClosed.cs
- Style.cs
- HitTestWithPointDrawingContextWalker.cs
- EntityDataSourceViewSchema.cs
- XPathItem.cs
- DbConnectionHelper.cs
- WebPartConnectionsConfigureVerb.cs
- ServiceOperationInfoTypeConverter.cs
- ListView.cs
- sqlinternaltransaction.cs
- EndOfStreamException.cs
- COM2Properties.cs
- CodePropertyReferenceExpression.cs
- RowCache.cs
- OleDbDataAdapter.cs
- ExtentKey.cs
- DataGridViewCellStyle.cs
- MetricEntry.cs
- HttpCookiesSection.cs
- HttpListenerContext.cs
- Drawing.cs
- MimePart.cs
- CodeComment.cs
- SolidBrush.cs
- SQLByteStorage.cs