in sdk/Common/Communication/RetryableServiceClient.cs [100:136]
public ServiceResponse EndSend(IAsyncResult ar)
{
if (ar == null)
throw new ArgumentNullException("ar");
var asyncResult = ar as AsyncResult<ServiceResponse>;
RetryableAsyncResult retryableAsyncResult = ar.AsyncState as RetryableAsyncResult;
if (asyncResult == null || retryableAsyncResult == null)
throw new InvalidOperationException("Invalid asynchronous invocation status.");
try
{
var response = asyncResult.GetResult();
return response;
}
catch (Exception ex)
{
if (retryableAsyncResult.OriginalContentPosition >= 0)
{
retryableAsyncResult.Request.Content.Seek(retryableAsyncResult.OriginalContentPosition,
SeekOrigin.Begin);
}
if (ShouldRetry(retryableAsyncResult.Request, ex, retryableAsyncResult.Retries))
{
Pause(retryableAsyncResult.Retries++);
BeginSendImpl(retryableAsyncResult.Request, retryableAsyncResult.Context, retryableAsyncResult);
}
// Rethrow
throw;
}
finally
{
asyncResult.Dispose();
}
}