public static void ModifyForRetry(Stream stream, int retries, ref int currentTry, string objectName, long offset, ref IEnumerable<Range> ranges, ref ITransferrer transferrer, Ds3ContentLengthNotMatch ex) { CanRetry(stream, retries, currentTry, objectName, offset, ex); // Issue a partial get for the remainder of the request // Seek back one byte to make sure that the connection did not fail part way through a byte stream.Seek(-1, SeekOrigin.Current); ranges = JobsUtil.RetryRanges(ranges, ex.BytesRead, ex.ContentLength); transferrer = new PartialReadTransferrer(); currentTry++; }
public void Transfer( IDs3Client client, string bucketName, string objectName, long blobOffset, Guid jobId, IEnumerable<Range> ranges, Stream stream) { var currentTry = 0; var transferrer = _transferrer; var _ranges = ranges; while (true) { try { transferrer.Transfer(client, bucketName, objectName, blobOffset, jobId, _ranges, stream); break; } catch (Ds3ContentLengthNotMatch exception) { if (_retries != -1 && currentTry >= _retries) { throw new Ds3NoMoreRetriesException(Resources.TooManyRetriesForPartialData, exception, currentTry); } // Issue a partial get for the remainder of the request // Seek back one byte to make sure that the connection did not fail part way through a byte stream.Seek(-1, SeekOrigin.Current); _ranges = JobsUtil.RetryRanges(_ranges, exception.BytesRead, exception.ContentLength); transferrer = new PartialReadTransferrer(); currentTry++; } } }