• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Runtime.TimeoutHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Runtime.TimeoutHelper的典型用法代码示例。如果您正苦于以下问题:C# TimeoutHelper类的具体用法?C# TimeoutHelper怎么用?C# TimeoutHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TimeoutHelper类属于System.Runtime命名空间,在下文中一共展示了TimeoutHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BeginWrite

 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, AsyncCallback callback, object state)
 {
     ThreadTrace.Trace("BC:BeginWrite");
     TimeoutHelper helper = new TimeoutHelper(timeout);
     this.Flush(helper.RemainingTime());
     return base.BeginWrite(buffer, offset, size, immediate, helper.RemainingTime(), callback, state);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:BufferedConnection.cs


示例2: OnOpen

        public override void OnOpen(TimeSpan timeout)
        {
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
            base.OnOpen(timeoutHelper.RemainingTime());
            if (this.Factory.ActAsInitiator)
            {
                // 1. Create a token requirement for the provider
                InitiatorServiceModelSecurityTokenRequirement tokenProviderRequirement = CreateInitiatorTokenRequirement();

                // 2. Create a provider
                SecurityTokenProvider tokenProvider = this.Factory.SecurityTokenManager.CreateSecurityTokenProvider(tokenProviderRequirement);
                SecurityUtils.OpenTokenProviderIfRequired(tokenProvider, timeoutHelper.RemainingTime());
                if (this.Factory.SecurityTokenParameters.HasAsymmetricKey)
                {
                    this.initiatorAsymmetricTokenProvider = tokenProvider;
                }
                else
                {
                    this.initiatorSymmetricTokenProvider = tokenProvider;
                }

                // 3. Create a token requirement for authenticator
                InitiatorServiceModelSecurityTokenRequirement tokenAuthenticatorRequirement = CreateInitiatorTokenRequirement();

                // 4. Create authenticator (we dont support out of band resolvers on the client side
                SecurityTokenResolver outOfBandTokenResolver;
                this.initiatorTokenAuthenticator = this.Factory.SecurityTokenManager.CreateSecurityTokenAuthenticator(tokenAuthenticatorRequirement, out outOfBandTokenResolver);
                SecurityUtils.OpenTokenAuthenticatorIfRequired(this.initiatorTokenAuthenticator, timeoutHelper.RemainingTime());
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:30,代码来源:SymmetricSecurityProtocol.cs


示例3: ParseIncomingResponse

        internal async Task<Message> ParseIncomingResponse(TimeoutHelper timeoutHelper)
        {
            ValidateAuthentication();
            ValidateResponseStatusCode();
            bool hasContent = await ValidateContentTypeAsync();
            Message message = null;

            if (!hasContent)
            {
                if (_encoder.MessageVersion == MessageVersion.None)
                {
                    message = new NullMessage();
                }
                else
                {
                    return null;
                }
            }
            else
            {
                message = await ReadStreamAsMessageAsync(timeoutHelper);
            }

            var exception = ProcessHttpAddressing(message);
            Contract.Assert(exception == null, "ProcessHttpAddressing should not set an exception after parsing a response message.");

            return message;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:28,代码来源:HttpResponseMessageHelper.cs


示例4: Reply

 public override void Reply(Message message, TimeSpan timeout)
 {
     TimeoutHelper helper = new TimeoutHelper(timeout);
     Message message2 = message;
     if (message != null)
     {
         CorrelationCallbackMessageProperty property;
         this.contextProtocol.OnOutgoingMessage(message, this);
         if (CorrelationCallbackMessageProperty.TryGet(message, out property))
         {
             ContextExchangeCorrelationHelper.AddOutgoingCorrelationCallbackData(property, message, false);
             if (property.IsFullyDefined)
             {
                 message2 = property.FinalizeCorrelation(message, helper.RemainingTime());
                 message2.Properties.Remove(CorrelationCallbackMessageProperty.Name);
             }
         }
     }
     try
     {
         this.innerContext.Reply(message2, helper.RemainingTime());
     }
     finally
     {
         if ((message != null) && !object.ReferenceEquals(message, message2))
         {
             message2.Close();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:ContextChannelRequestContext.cs


示例5: OnCreateSecurityProtocol

 protected override SecurityProtocol OnCreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, TimeSpan timeout)
 {
     SecurityProtocolFactory protocolFactoryForOutgoingMessages = this.ProtocolFactoryForOutgoingMessages;
     SecurityProtocolFactory protocolFactoryForIncomingMessages = this.ProtocolFactoryForIncomingMessages;
     TimeoutHelper helper = new TimeoutHelper(timeout);
     SecurityProtocol outgoingProtocol = (protocolFactoryForOutgoingMessages == null) ? null : protocolFactoryForOutgoingMessages.CreateSecurityProtocol(target, via, listenerSecurityState, false, helper.RemainingTime());
     return new DuplexSecurityProtocol(outgoingProtocol, (protocolFactoryForIncomingMessages == null) ? null : protocolFactoryForIncomingMessages.CreateSecurityProtocol(null, null, listenerSecurityState, false, helper.RemainingTime()));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DuplexSecurityProtocolFactory.cs


示例6: LoadRetryAsyncResult

 public LoadRetryAsyncResult(SqlWorkflowInstanceStore store, System.Runtime.DurableInstancing.InstancePersistenceContext context, System.Runtime.DurableInstancing.InstancePersistenceCommand command, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.InstanceStore = store;
     this.InstancePersistenceContext = context;
     this.InstancePersistenceCommand = command;
     this.commandTimeout = new TimeoutHelper(timeout);
     this.InstanceStore.BeginTryCommandInternal(this.InstancePersistenceContext, this.InstancePersistenceCommand, this.commandTimeout.RemainingTime(), onTryCommandCallback, this);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:LoadRetryAsyncResult.cs


示例7: TimeoutStream

 public TimeoutStream(Stream stream, ref TimeoutHelper timeoutHelper) : base(stream)
 {
     if (!stream.CanTimeout)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("stream", System.ServiceModel.SR.GetString("StreamDoesNotSupportTimeout"));
     }
     this.timeoutHelper = timeoutHelper;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TimeoutStream.cs


示例8: OnClose

 protected override void OnClose(TimeSpan timeout)
 {
     TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
     base.OnClose(timeoutHelper.RemainingTime());
     if (this.transportManagerContainer != null && !TransferTransportManagers())
     {
         this.transportManagerContainer.Close(timeoutHelper.RemainingTime());
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:TransportReplyChannelAcceptor.cs


示例9: SendReceiveAsyncResult

 internal SendReceiveAsyncResult(SendReceiveReliableRequestor requestor, Message request, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.requestor = requestor;
     this.request = request;
     this.timeoutHelper = new TimeoutHelper(timeout);
     if (this.BeginSend())
     {
         base.Complete(true);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:SendReceiveReliableRequestor.cs


示例10: OnClose

 protected override void OnClose(TimeSpan timeout)
 {
     TimeoutHelper helper = new TimeoutHelper(timeout);
     base.Connection.Write(SingletonEncoder.EndBytes, 0, SingletonEncoder.EndBytes.Length, true, helper.RemainingTime());
     this.connectionDemuxer.ReuseConnection(this.rawConnection, helper.RemainingTime());
     if (this.channelBindingToken != null)
     {
         this.channelBindingToken.Dispose();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ServerSingletonConnectionReader.cs


示例11: SqlCommandAsyncResult

 public SqlCommandAsyncResult(SqlCommand sqlCommand, string connectionString, DependentTransaction dependentTransaction, TimeSpan timeout, int retryCount, int maximumRetries, AsyncCallback callback, object state) : base(callback, state)
 {
     long num = Math.Min(timeout.Ticks, MaximumOpenTimeout.Ticks);
     this.sqlCommand = sqlCommand;
     this.connectionString = connectionString;
     this.dependentTransaction = dependentTransaction;
     this.timeoutHelper = new TimeoutHelper(TimeSpan.FromTicks(num));
     this.retryCount = retryCount;
     this.maximumRetries = maximumRetries;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:SqlCommandAsyncResult.cs


示例12: Abandon

        public virtual void Abandon(Exception exception, TimeSpan timeout)
        {
            EnsureValidTimeout(timeout);
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
            this.WaitForStateLock(timeoutHelper.RemainingTime());

            try
            {
                if (PreAbandon())
                {
                    return;
                }
            }
            finally
            {
                // Abandon can never be reverted, release the state lock.
                this.ReleaseStateLock();
            }

            bool success = false;
            try
            {
                if (exception == null)
                {
                    OnAbandon(timeoutHelper.RemainingTime());
                }
                else
                {
                    if (TD.ReceiveContextAbandonWithExceptionIsEnabled())
                    {
                        TD.ReceiveContextAbandonWithException(this.eventTraceActivity, this.GetType().ToString(), exception.GetType().ToString());
                    }
                    OnAbandon(exception, timeoutHelper.RemainingTime());
                }
                lock (ThisLock)
                {
                    ThrowIfFaulted();
                    ThrowIfNotAbandoning();
                    this.State = ReceiveContextState.Abandoned;
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    if (TD.ReceiveContextAbandonFailedIsEnabled())
                    {
                        TD.ReceiveContextAbandonFailed(this.eventTraceActivity, this.GetType().ToString());
                    }
                    Fault();
                }
            }

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:55,代码来源:ReceiveContext.cs


示例13: BeginSecureOutgoingMessageAtInitiatorCore

 protected virtual IAsyncResult BeginSecureOutgoingMessageAtInitiatorCore(Message message, string actor, TimeSpan timeout, AsyncCallback callback, object state)
 {
     IList<SupportingTokenSpecification> list;
     TimeoutHelper helper = new TimeoutHelper(timeout);
     if (base.TryGetSupportingTokens(base.SecurityProtocolFactory, base.Target, base.Via, message, helper.RemainingTime(), false, out list))
     {
         this.SetUpDelayedSecurityExecution(ref message, actor, list);
         return new CompletedAsyncResult<Message>(message, callback, state);
     }
     return new SecureOutgoingMessageAsyncResult(actor, message, this, timeout, callback, state);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:TransportSecurityProtocol.cs


示例14: CloseCommunicationAsyncResult

 public CloseCommunicationAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, object mutex) : base(callback, state)
 {
     this.timeout = timeout;
     this.timeoutHelper = new TimeoutHelper(timeout);
     this.mutex = mutex;
     if (timeout < TimeSpan.Zero)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TimeoutException(System.ServiceModel.SR.GetString("SFxCloseTimedOut1", new object[] { timeout })));
     }
     this.timer = new IOThreadTimer(new Action<object>(CloseCommunicationAsyncResult.TimeoutCallback), this, true);
     this.timer.Set(timeout);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:CloseCommunicationAsyncResult.cs


示例15: OnClose

 public override void OnClose(TimeSpan timeout)
 {
     TimeoutHelper helper = new TimeoutHelper(timeout);
     if (this.forwardProtocolFactory != null)
     {
         this.forwardProtocolFactory.Close(false, helper.RemainingTime());
     }
     if (this.reverseProtocolFactory != null)
     {
         this.reverseProtocolFactory.Close(false, helper.RemainingTime());
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:DuplexSecurityProtocolFactory.cs


示例16: OnRequest

 protected override Message OnRequest(Message request, TimeSpan timeout, bool last)
 {
     RequestContext context;
     TimeoutHelper helper = new TimeoutHelper(timeout);
     base.Binder.Send(request, helper.RemainingTime(), MaskingMode.None);
     TimeSpan receiveTimeout = this.GetReceiveTimeout(helper.RemainingTime());
     base.Binder.TryReceive(receiveTimeout, out context, MaskingMode.None);
     if (context == null)
     {
         return null;
     }
     return context.RequestMessage;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SendReceiveReliableRequestor.cs


示例17: CloseInitiate

 private void CloseInitiate(TimeSpan timeout)
 {
     TimeoutHelper helper = new TimeoutHelper(timeout);
     foreach (InstanceContext context in this.ToArray())
     {
         try
         {
             if (context.State == CommunicationState.Opened)
             {
                 IAsyncResult result = context.BeginClose(helper.RemainingTime(), Fx.ThunkCallback(new AsyncCallback(InstanceContextManager.CloseInstanceContextCallback)), context);
                 if (result.CompletedSynchronously)
                 {
                     context.EndClose(result);
                 }
             }
             else
             {
                 context.Abort();
             }
         }
         catch (ObjectDisposedException exception)
         {
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
             }
         }
         catch (InvalidOperationException exception2)
         {
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
             }
         }
         catch (CommunicationException exception3)
         {
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
             }
         }
         catch (TimeoutException exception4)
         {
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 DiagnosticUtility.ExceptionUtility.TraceHandledException(exception4, TraceEventType.Information);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:InstanceContextManager.cs


示例18: VerifyIncomingMessageCore

 protected override void VerifyIncomingMessageCore(ref Message message, TimeSpan timeout)
 {
     string actor = string.Empty;
     ReceiveSecurityHeader securityHeader = this.Factory.StandardsManager.CreateReceiveSecurityHeader(message, actor, this.Factory.IncomingAlgorithmSuite, MessageDirection.Input);
     securityHeader.RequireMessageProtection = false;
     securityHeader.ReaderQuotas = this.Factory.SecurityBindingElement.ReaderQuotas;
     IList<SupportingTokenAuthenticatorSpecification> supportingAuthenticators = base.GetSupportingTokenAuthenticatorsAndSetExpectationFlags(this.Factory, message, securityHeader);
     ReadOnlyCollection<SecurityTokenResolver> outOfBandResolvers = base.MergeOutOfBandResolvers(supportingAuthenticators, this.sessionTokenResolverList);
     if ((supportingAuthenticators != null) && (supportingAuthenticators.Count > 0))
     {
         supportingAuthenticators = new List<SupportingTokenAuthenticatorSpecification>(supportingAuthenticators);
         supportingAuthenticators.Insert(0, this.sessionTokenAuthenticatorSpecificationList[0]);
     }
     else
     {
         supportingAuthenticators = this.sessionTokenAuthenticatorSpecificationList;
     }
     securityHeader.ConfigureTransportBindingServerReceiveHeader(supportingAuthenticators);
     securityHeader.ConfigureOutOfBandTokenResolver(outOfBandResolvers);
     securityHeader.ExpectEndorsingTokens = true;
     TimeoutHelper helper = new TimeoutHelper(timeout);
     securityHeader.SetTimeParameters(this.Factory.NonceCache, this.Factory.ReplayWindow, this.Factory.MaxClockSkew);
     securityHeader.EnforceDerivedKeyRequirement = message.Headers.Action != this.Factory.StandardsManager.SecureConversationDriver.CloseAction.Value;
     securityHeader.Process(helper.RemainingTime(), System.ServiceModel.Security.SecurityUtils.GetChannelBindingFromMessage(message), this.Factory.ExtendedProtectionPolicy);
     if (securityHeader.Timestamp == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(System.ServiceModel.SR.GetString("RequiredTimestampMissingInSecurityHeader")));
     }
     bool flag = false;
     if (securityHeader.EndorsingSupportingTokens != null)
     {
         for (int i = 0; i < securityHeader.EndorsingSupportingTokens.Count; i++)
         {
             SecurityContextSecurityToken token = securityHeader.EndorsingSupportingTokens[i] as SecurityContextSecurityToken;
             if ((token != null) && (token.ContextId == this.sessionId))
             {
                 flag = true;
                 break;
             }
         }
     }
     if (!flag)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(System.ServiceModel.SR.GetString("NoSessionTokenPresentInMessage")));
     }
     message = securityHeader.ProcessedMessage;
     base.AttachRecipientSecurityProperty(message, securityHeader.BasicSupportingTokens, securityHeader.EndorsingSupportingTokens, securityHeader.SignedEndorsingSupportingTokens, securityHeader.SignedSupportingTokens, securityHeader.SecurityTokenAuthorizationPoliciesMapping);
     base.OnIncomingMessageVerified(message);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:49,代码来源:AcceptorSessionSymmetricTransportSecurityProtocol.cs


示例19: BeginSecureOutgoingMessageAtInitiatorCore

 protected override IAsyncResult BeginSecureOutgoingMessageAtInitiatorCore(Message message, string actor, TimeSpan timeout, AsyncCallback callback, object state)
 {
     SecurityToken token;
     SecurityToken token2;
     SecurityTokenParameters parameters;
     IList<SupportingTokenSpecification> list;
     this.GetTokensForOutgoingMessages(out token, out token2, out parameters);
     TimeoutHelper helper = new TimeoutHelper(timeout);
     if (!base.TryGetSupportingTokens(base.SecurityProtocolFactory, base.Target, base.Via, message, helper.RemainingTime(), false, out list))
     {
         return new SecureOutgoingMessageAsyncResult(actor, message, this, token, token2, parameters, helper.RemainingTime(), callback, state);
     }
     this.SetupDelayedSecurityExecution(actor, ref message, token, token2, parameters, list);
     return new CompletedAsyncResult<Message>(message, callback, state);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:InitiatorSessionSymmetricTransportSecurityProtocol.cs


示例20: CreateWebSocketAsync

        public override async Task<WebSocket> CreateWebSocketAsync(Uri address, WebHeaderCollection headers, ICredentials credentials,
            WebSocketTransportSettings settings, TimeoutHelper timeoutHelper)
        {
            ClientWebSocket webSocket = new ClientWebSocket();
            webSocket.Options.Credentials = credentials;
            webSocket.Options.AddSubProtocol(settings.SubProtocol);
            webSocket.Options.KeepAliveInterval = settings.KeepAliveInterval;
            foreach (var headerObj in headers)
            {
                var header = headerObj as string;
                webSocket.Options.SetRequestHeader(header, headers[header]);
            }

            await webSocket.ConnectAsync(address, timeoutHelper.CancellationToken);
            return webSocket;
        }
开发者ID:noodlese,项目名称:wcf,代码行数:16,代码来源:CoreClrClientWebSocketFactory.cs



注:本文中的System.Runtime.TimeoutHelper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Caching.CacheItem类代码示例发布时间:2022-05-26
下一篇:
C# Runtime.EEType类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap