diff options
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/Bindings')
-rw-r--r-- | src/DotNetOpenAuth.Core/Messaging/Bindings/StandardExpirationBindingElement.cs | 7 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardExpirationBindingElement.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardExpirationBindingElement.cs index c706e42..f19d4bd 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardExpirationBindingElement.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardExpirationBindingElement.cs @@ -15,7 +15,14 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// implementing the <see cref="IExpiringProtocolMessage"/> interface. /// </summary> internal class StandardExpirationBindingElement : IChannelBindingElement { + /// <summary> + /// A reusable pre-completed task that may be returned multiple times to reduce GC pressure. + /// </summary> private static readonly Task<MessageProtections?> NullTask = Task.FromResult<MessageProtections?>(null); + + /// <summary> + /// A reusable pre-completed task that may be returned multiple times to reduce GC pressure. + /// </summary> private static readonly Task<MessageProtections?> CompletedExpirationTask = Task.FromResult<MessageProtections?>(MessageProtections.Expiration); /// <summary> diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs index 6c062d6..65c7882 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs @@ -15,7 +15,14 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// A binding element that checks/verifies a nonce message part. /// </summary> internal class StandardReplayProtectionBindingElement : IChannelBindingElement { + /// <summary> + /// A reusable, precompleted task that can be returned many times to reduce GC pressure. + /// </summary> private static readonly Task<MessageProtections?> NullTask = Task.FromResult<MessageProtections?>(null); + + /// <summary> + /// A reusable, precompleted task that can be returned many times to reduce GC pressure. + /// </summary> private static readonly Task<MessageProtections?> CompletedReplayProtectionTask = Task.FromResult<MessageProtections?>(MessageProtections.ReplayProtection); /// <summary> |