1
1
/*
2
- * Copyright (C) 2019 HERE Europe B.V.
2
+ * Copyright (C) 2019-2023 HERE Europe B.V.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -127,10 +127,10 @@ - (OLPHttpTask*)taskWithId:(olp::http::RequestId)identifier {
127
127
return task;
128
128
}
129
129
130
- - (OLPHttpTask*)taskWithTaskIdentifier : ( NSUInteger ) taskId {
130
+ - (OLPHttpTask*)taskWithTaskDescription : ( NSString *) taskDescription {
131
131
OLPHttpTask* task = nil ;
132
132
@synchronized (_tasks) {
133
- task = self.idTaskMap [@(taskId) ];
133
+ task = [ self .idTaskMap objectForKey: taskDescription ];
134
134
}
135
135
return task;
136
136
}
@@ -154,7 +154,7 @@ - (void)removeTaskWithId:(olp::http::RequestId)identifier {
154
154
OLPHttpTask* task = _tasks[@(identifier)];
155
155
if (task.dataTask ) {
156
156
[task.dataTask cancel ];
157
- [self .idTaskMap removeObjectForKey: @( task.dataTask.taskIdentifier) ];
157
+ [self .idTaskMap removeObjectForKey: [ task createTaskDescription ] ];
158
158
}
159
159
[_tasks removeObjectForKey: @(identifier)];
160
160
[self .urlSessions removeObjectForKey: @(identifier)];
@@ -176,7 +176,7 @@ - (void)URLSession:(NSURLSession*)session
176
176
}
177
177
178
178
@autoreleasepool {
179
- OLPHttpTask* httpTask = [self taskWithTaskIdentifier : task.taskIdentifier ];
179
+ OLPHttpTask* httpTask = [self taskWithTaskDescription : task.taskDescription ];
180
180
if ([httpTask isValid ]) {
181
181
[httpTask didCompleteWithError: error];
182
182
[self removeTaskWithId: httpTask.requestId];
@@ -207,7 +207,7 @@ - (void)URLSession:(NSURLSession*)session
207
207
208
208
@autoreleasepool {
209
209
OLPHttpTask* httpTask =
210
- [self taskWithTaskIdentifier : dataTask.taskIdentifier ];
210
+ [self taskWithTaskDescription : dataTask.taskDescription ];
211
211
if ([httpTask isValid ] && ![httpTask isCancelled ]) {
212
212
[httpTask didReceiveResponse: response];
213
213
} else {
@@ -236,7 +236,7 @@ - (void)URLSession:(NSURLSession*)session
236
236
237
237
@autoreleasepool {
238
238
OLPHttpTask* httpTask =
239
- [self taskWithTaskIdentifier : dataTask.taskIdentifier ];
239
+ [self taskWithTaskDescription : dataTask.taskDescription ];
240
240
if ([httpTask isValid ] && ![httpTask isCancelled ]) {
241
241
[httpTask didReceiveData: data];
242
242
} else {
@@ -267,7 +267,7 @@ - (void)URLSession:(NSURLSession*)session
267
267
isEqualToString: NSURLAuthenticationMethodServerTrust ]) {
268
268
if (dataTask) {
269
269
OLPHttpTask* httpTask =
270
- [self taskWithTaskIdentifier : dataTask.taskIdentifier ];
270
+ [self taskWithTaskDescription : dataTask.taskDescription ];
271
271
if (![httpTask isValid ]) {
272
272
return ;
273
273
}
@@ -429,9 +429,9 @@ - (NSURLSession*)urlSessionWithProxy:
429
429
430
430
- (void )registerDataTask : (NSURLSessionDataTask *)dataTask
431
431
forHttpTask : (OLPHttpTask*)httpTask {
432
- NSNumber * identifier = @( dataTask.taskIdentifier ) ;
432
+ NSString * identifier = dataTask.taskDescription ;
433
433
@synchronized (_tasks) {
434
- self.idTaskMap [identifier] = httpTask;
434
+ [ self .idTaskMap setValue: httpTask forKey: identifier] ;
435
435
}
436
436
}
437
437
0 commit comments