Skip to content

Commit 59f9c35

Browse files
Eric Zhongminggo
authored andcommitted
fix downloader will not be conitnue (#17761)
if already has started six data task, then start 7th task will suspend, it will not be run
1 parent 58b8e77 commit 59f9c35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public void onSuccess(int i, Header[] headers, byte[] binaryData) {
6262
LogD("onSuccess(i:" + i + " headers:" + headers);
6363
_downloader.onFinish(_id, 0, null, binaryData);
6464
}
65+
66+
@Override
67+
public void onFinish() {
68+
// onFinish called after onSuccess/onFailure
69+
_downloader.runNextTaskIfExists();
70+
}
6571
}
6672

6773
class HeadTaskHandler extends AsyncHttpResponseHandler {
@@ -97,6 +103,12 @@ public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
97103
Cocos2dxDownloader.setResumingSupport(_host, acceptRanges);
98104
Cocos2dxDownloader.createTask(_downloader, _id, _url, _path);
99105
}
106+
107+
@Override
108+
public void onFinish() {
109+
// onFinish called after onSuccess/onFailure
110+
_downloader.runNextTaskIfExists();
111+
}
100112

101113
@Override
102114
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable throwable) {

0 commit comments

Comments
 (0)