Exemplo n.º 1
0
        internal RequestRetryHandler(HttpConnector httpConnector, ManualAsyncResult result)
        {
            RequestRetries = 0;

            HttpConnector = httpConnector;

            Result = result;
        }
Exemplo n.º 2
0
        internal ManualAsyncResult RetryRequest()
        {
            try
            {
                HttpConnector.Con.SetNewHost();

                if (Result.HttpWebRequest.Method == "GET")
                {
                    Result = HttpConnector.RequestGet(Result);
                }

                else if (Result.HttpWebRequest.Method == "Post")
                {
                    Result = HttpConnector.RequestPost(Result);
                }

                Result.TimeOutWait();

                if (Result.Error == null)
                {
                    return(Result);
                }

                throw Result.Error;
            }
            catch (Exception)
            {
                RequestRetries++;

                if (RequestRetries < 5)
                {
                    return(RetryRequest());
                }

                throw new Exception("Too Many Request Failures");
            }
        }