/// <summary>
        /// Occurs when any of the following network conditions occur:
        /// 1. Unable to connect to target host for any reason
        /// 2. Write request fails
        /// 3. Read request fails
        /// </summary>
        /// <param name="response">The <see cref="Response"/> that contains information about the failure</param>
        /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
        protected override void OnCommunicationFailure(Response response, object state)
        {
            SubscriptionResponse sr = SubscriptionResponse.FromResponse(response, null);

            ResetTimerBasedOnResponse(sr);
            this.OnErrorResponse(sr);
        }
示例#2
0
        /// <summary>

        /// Parses the response and raises the appropriate event

        /// </summary>

        /// <param name="responseText">The raw GNTP response</param>

        /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>

        protected override void OnResponseReceived(string responseText, object state)

        {
            CallbackData cd;

            HeaderCollection headers;

            MessageParser mp = new MessageParser();

            Response response = mp.Parse(responseText, out cd, out headers);



            SubscriptionResponse sr = SubscriptionResponse.FromResponse(response, headers);



            ResetTimerBasedOnResponse(sr);



            if (sr.IsOK)

            {
                this.OnOKResponse(sr);
            }

            else

            {
                this.OnErrorResponse(sr);
            }
        }