[android] - limit concurrent request for Android 4.4 and below to 10 (#14971)

This commit is contained in:
Tobrun
2019-06-20 17:34:39 +02:00
committed by GitHub
parent 577e03f949
commit 24b7b413b5

View File

@@ -182,9 +182,15 @@ public class HttpRequestImpl implements HttpRequest {
@NonNull
private static Dispatcher getDispatcher() {
Dispatcher dispatcher = new Dispatcher();
// Matches core limit set on
// https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/src/http_file_source.cpp#L192
dispatcher.setMaxRequestsPerHost(20);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Matches core limit set on
// https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/src/http_file_source.cpp#L192
dispatcher.setMaxRequestsPerHost(20);
} else {
// Limiting concurrent request on Android 4.4, to limit impact of SSL handshake platform library crash
// https://github.com/mapbox/mapbox-gl-native/issues/14910
dispatcher.setMaxRequestsPerHost(10);
}
return dispatcher;
}
}