Skip to content

Commit d8d2456

Browse files
authored
Make it possible to control multipath TCP support (#780)
1 parent 8308158 commit d8d2456

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

pkgs/cupertino_http/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 0.0.4
22

33
* Add the ability to control caching policy.
4+
* Add the ability to control multipath TCP connections.
45

56
## 0.0.3
67

pkgs/cupertino_http/example/integration_test/url_session_configuration_test.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ void testProperties(URLSessionConfiguration config) {
5454
config.httpShouldUsePipelining = false;
5555
expect(config.httpShouldUsePipelining, false);
5656
});
57+
test('multipathServiceType', () {
58+
expect(config.multipathServiceType,
59+
URLSessionMultipathServiceType.multipathServiceTypeNone);
60+
config.multipathServiceType =
61+
URLSessionMultipathServiceType.multipathServiceTypeAggregate;
62+
expect(config.multipathServiceType,
63+
URLSessionMultipathServiceType.multipathServiceTypeAggregate);
64+
config.multipathServiceType =
65+
URLSessionMultipathServiceType.multipathServiceTypeNone;
66+
expect(config.multipathServiceType,
67+
URLSessionMultipathServiceType.multipathServiceTypeNone);
68+
});
5769
test('requestCachePolicy', () {
5870
config.requestCachePolicy = URLRequestCachePolicy.returnCacheDataDontLoad;
5971
expect(config.requestCachePolicy,

pkgs/cupertino_http/lib/cupertino_http.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ enum URLRequestCachePolicy {
6262
reloadRevalidatingCacheData,
6363
}
6464

65+
// Controls how multipath TCP should be used.
66+
//
67+
// See [NSURLSessionMultipathServiceType](https://developer.apple.com/documentation/foundation/nsurlsessionmultipathservicetype).
68+
enum URLSessionMultipathServiceType {
69+
multipathServiceTypeNone,
70+
multipathServiceTypeHandover,
71+
multipathServiceTypeInteractive,
72+
multipathServiceTypeAggregate,
73+
}
74+
6575
// Controls how [URLSessionTask] execute will proceed after the response is
6676
// received.
6777
//
@@ -202,6 +212,14 @@ class URLSessionConfiguration
202212
set httpShouldUsePipelining(bool value) =>
203213
_nsObject.HTTPShouldUsePipelining = value;
204214

215+
/// What type of Multipath TCP connections to use.
216+
///
217+
/// See [NSURLSessionConfiguration.multipathServiceType](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/2875967-multipathservicetype)
218+
URLSessionMultipathServiceType get multipathServiceType =>
219+
URLSessionMultipathServiceType.values[_nsObject.multipathServiceType];
220+
set multipathServiceType(URLSessionMultipathServiceType value) =>
221+
_nsObject.multipathServiceType = value.index;
222+
205223
// Controls how to deal with response caching.
206224
//
207225
// See [NSURLSessionConfiguration.requestCachePolicy](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411655-requestcachepolicy)

0 commit comments

Comments
 (0)