From b0335577e52f83c29e86da63697001cfead4ea5e Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 28 Jan 2014 12:20:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A54M=E4=B8=BA=E5=8D=95=E4=BD=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=95=B0=E6=8D=AE=E7=89=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/qiniu/rs/up.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/qiniu/rs/up.rb b/lib/qiniu/rs/up.rb index 84ff127..55a603a 100755 --- a/lib/qiniu/rs/up.rb +++ b/lib/qiniu/rs/up.rb @@ -127,6 +127,7 @@ module Qiniu def _resumable_put_block(uptoken, fh, block_index, block_size, chunk_size, progress, retry_times, notifier) code, data = 0, {} fpath = fh.path + # this block has never been uploaded. if progress[:ctx] == nil || progress[:ctx].empty? progress[:offset] = 0 @@ -159,6 +160,7 @@ module Qiniu elsif progress[:offset] + progress[:restsize] != block_size raise BlockSizeNotMathchError.new(fpath, block_index, progress[:offset], progress[:restsize], block_size) end + # loop uploading other chunks except the first one while progress[:restsize].to_i > 0 && progress[:restsize] < block_size # choose the smaller one @@ -213,7 +215,9 @@ module Qiniu if progresses[block_index].nil? progresses[block_index] = _new_block_put_progress_data end - code, data = _resumable_put_block(uptoken, fh, block_index, block_size, Config.settings[:chunk_size], progresses[block_index], Config.settings[:max_retry_times], chunk_notifier) + #code, data = _resumable_put_block(uptoken, fh, block_index, block_size, Config.settings[:chunk_size], progresses[block_index], Config.settings[:max_retry_times], chunk_notifier) + # Put the whole block as a chunk + code, data = _resumable_put_block(uptoken, fh, block_index, block_size, block_size, progresses[block_index], Config.settings[:max_retry_times], chunk_notifier) if Utils.is_response_ok?(code) #checksums[block_index] = data["checksum"] checksums[block_index] = data["ctx"]