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
This commit is contained in:
Eric Zhong 2017-05-03 10:57:42 +08:00 committed by minggo
parent 58b8e77d74
commit 59f9c35f34
1 changed files with 12 additions and 0 deletions

View File

@ -62,6 +62,12 @@ class DataTaskHandler extends BinaryHttpResponseHandler {
LogD("onSuccess(i:" + i + " headers:" + headers);
_downloader.onFinish(_id, 0, null, binaryData);
}
@Override
public void onFinish() {
// onFinish called after onSuccess/onFailure
_downloader.runNextTaskIfExists();
}
}
class HeadTaskHandler extends AsyncHttpResponseHandler {
@ -97,6 +103,12 @@ class HeadTaskHandler extends AsyncHttpResponseHandler {
Cocos2dxDownloader.setResumingSupport(_host, acceptRanges);
Cocos2dxDownloader.createTask(_downloader, _id, _url, _path);
}
@Override
public void onFinish() {
// onFinish called after onSuccess/onFailure
_downloader.runNextTaskIfExists();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable throwable) {