Skip to content

Commit d11e4f8

Browse files
刘斌刘斌
authored andcommitted
7.0 retry 2
1 parent adc785a commit d11e4f8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

library/src/main/java/com/qiniu/android/storage/ResumeUploader.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void complete(ResponseInfo info, JSONObject response) {
209209
return;
210210
}
211211

212-
if (isNotQiniu(info) || (info.needRetry() && retried < config.retryMax)) {
212+
if ((isNotQiniu(info) || info.needRetry()) && retried < config.retryMax) {
213213
nextTask(offset, retried + 1, config.upBackup.address);
214214
return;
215215
}
@@ -241,22 +241,22 @@ public void complete(ResponseInfo info, JSONObject response) {
241241
completionHandler.complete(key, i, null);
242242
return;
243243
}
244-
if (info.statusCode == 701) {
245-
nextTask((offset / Configuration.BLOCK_SIZE) * Configuration.BLOCK_SIZE, retried, address);
244+
if (info.statusCode == 701 && retried < config.retryMax) {
245+
nextTask((offset / Configuration.BLOCK_SIZE) * Configuration.BLOCK_SIZE, retried + 1, address);
246246
return;
247247
}
248248

249-
if (!isNotQiniu(info) && (retried >= config.retryMax || !info.needRetry())) {
250-
completionHandler.complete(key, info, null);
249+
if ((isNotQiniu(info) || info.needRetry()) && retried < config.retryMax) {
250+
nextTask(offset, retried + 1, config.upBackup.address);
251251
return;
252252
}
253253

254-
nextTask(offset, retried + 1, config.upBackup.address);
254+
completionHandler.complete(key, info, null);
255255
return;
256256
}
257257
String context = null;
258258

259-
if (response == null) {
259+
if (response == null && retried < config.retryMax) {
260260
nextTask(offset, retried + 1, config.upBackup.address);
261261
return;
262262
}
@@ -267,7 +267,7 @@ public void complete(ResponseInfo info, JSONObject response) {
267267
} catch (JSONException e) {
268268
e.printStackTrace();
269269
}
270-
if (context == null || crc != ResumeUploader.this.crc32) {
270+
if ((context == null || crc != ResumeUploader.this.crc32) && retried < config.retryMax) {
271271
nextTask(offset, retried + 1, config.upBackup.address);
272272
return;
273273
}

0 commit comments

Comments
 (0)