private void OnWebRequestAgentHelperError(object sender, WebRequestAgentHelperErrorEventArgs e) { m_Helper.Reset(); m_Task.Status = WebRequestTaskStatus.Error; WebRequestAwaitEventArgs webRequestAwaitEventArgs = WebRequestAwaitEventArgs.Create(m_Task.SerialId, m_Task.WebRequestUri, null, e.ErrorMessage, WebRequestCallBackStatus.Failed); m_Task.AsyncAction?.Invoke(webRequestAwaitEventArgs); ReferencePool.Release(webRequestAwaitEventArgs); m_Task.Done = true; }
/// <summary> /// Web 请求代理轮询。 /// </summary> /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位。</param> /// <param name="realElapseSeconds">真实流逝时间,以秒为单位。</param> public void Update(float elapseSeconds, float realElapseSeconds) { if (m_Task.Status == WebRequestTaskStatus.Doing) { m_WaitTime += realElapseSeconds; if (m_WaitTime >= m_Task.Timeout) { WebRequestAgentHelperErrorEventArgs webRequestAgentHelperErrorEventArgs = WebRequestAgentHelperErrorEventArgs.Create("Timeout"); OnWebRequestAgentHelperError(this, webRequestAgentHelperErrorEventArgs); ReferencePool.Release(webRequestAgentHelperErrorEventArgs); } } m_Helper.Update(); }