Skip to content

Commit b8625bd

Browse files
committed
5xx change back to source
1 parent 10be0cf commit b8625bd

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

library/src/main/java/com/qiniu/android/http/ResponseInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public boolean isServerError() {
8181
return (statusCode >= 500 && statusCode < 600 && statusCode != 579) || statusCode == 996;
8282
}
8383

84+
public boolean needSwitchServer(){
85+
return isNetworkBroken() || (statusCode >= 500 && statusCode < 600 && statusCode != 579);
86+
}
87+
8488
public boolean needRetry() {
8589
return isNetworkBroken() || isServerError() || statusCode == 406 || (statusCode == 200 && error != null);
8690
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void complete(ResponseInfo info, JSONObject response) {
121121
}
122122
};
123123
String host = Config.UP_HOST;
124-
if (info.isNetworkBroken()) {
124+
if (info.needSwitchServer()) {
125125
host = Config.UP_HOST_BACKUP;
126126
}
127127
httpManager.multipartPost("http://" + host, args, progress, retried);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public void complete(ResponseInfo info, JSONObject response) {
216216
return;
217217
}
218218
String host2 = host;
219-
if (info.isNetworkBroken()) {
219+
if (info.needSwitchServer()) {
220220
host2 = Config.UP_HOST_BACKUP;
221221
}
222222
nextTask(offset, retried + 1, host2);

0 commit comments

Comments
 (0)