We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/cocos-creator/cocos2d-x-lite/blob/v2.4.1/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java#L98
new OkHttpClient().newBuilder() .followRedirects(true) .followSslRedirects(true) .callTimeout(timeoutInSeconds, TimeUnit.SECONDS) .build();
根据 OkHttp 的 callTimeout 文档 应该是整个请求的完成时间, 这与我们的设计是否有出入? 这里使用 callTimeout 是否合理?
callTimeout
经过测试, 如果这个时间设置的较小, 下载文件的时间大于这个时间时必然会下载失败:
java.net.SocketException: Socket closed
或
okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
经过测试, 将 callTimeout 换为 connectTimeout/writeTimeout/readTimeout 可以满足需求.
connectTimeout/writeTimeout/readTimeout
new OkHttpClient().newBuilder() .followRedirects(true) .followSslRedirects(true) .connectTimeout(timeoutInSeconds, TimeUnit.SECONDS) .writeTimeout(timeoutInSeconds, TimeUnit.SECONDS) .readTimeout(timeoutInSeconds, TimeUnit.SECONDS) .build();
The text was updated successfully, but these errors were encountered:
new jsb.Downloader({ timeoutInSeconds: 45 * 60, countOfMaxProcessingTasks: 6, tempFileNameSuffix: ".tmp", });
可以按照需求自己加参数。
Sorry, something went wrong.
No branches or pull requests
https://github.com/cocos-creator/cocos2d-x-lite/blob/v2.4.1/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java#L98
根据 OkHttp 的 callTimeout 文档 应该是整个请求的完成时间, 这与我们的设计是否有出入? 这里使用
callTimeout
是否合理?经过测试, 如果这个时间设置的较小, 下载文件的时间大于这个时间时必然会下载失败:
或
经过测试, 将
callTimeout
换为connectTimeout/writeTimeout/readTimeout
可以满足需求.The text was updated successfully, but these errors were encountered: