diff options
author | Aleksey Belouosv <aleksey@maps.me> | 2019-03-18 14:54:31 +0300 |
---|---|---|
committer | Zoia <niakris90@gmail.com> | 2019-03-18 18:34:33 +0300 |
commit | e029c9f96105fb83b6a4cdc2ee647d094fb282b4 (patch) | |
tree | ef818c4a0e71cb7a92be5a989d32f1fd2eb6d7e1 /platform | |
parent | 781a24ea68adeb75958455a1907e8fabfe14933e (diff) |
[iOS] fix HttpSessionManager synchronization
Diffstat (limited to 'platform')
-rw-r--r-- | platform/http_session_manager.mm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/platform/http_session_manager.mm b/platform/http_session_manager.mm index 1aaebf93fd..ec8d748b01 100644 --- a/platform/http_session_manager.mm +++ b/platform/http_session_manager.mm @@ -80,7 +80,14 @@ - (void)setDataTaskInfo:(DataTaskInfo *)taskInfo forTask:(NSURLSessionTask *)task { dispatch_barrier_sync(self.taskInfoQueue, ^{ - self.taskInfoByTaskID[task] = taskInfo; + self.taskInfoByTaskID[@(task.taskIdentifier)] = taskInfo; + }); +} + +- (void)removeTaskInfoForTask:(NSURLSessionTask *)task +{ + dispatch_barrier_sync(self.taskInfoQueue, ^{ + [self.taskInfoByTaskID removeObjectForKey:@(task.taskIdentifier)]; }); } @@ -88,7 +95,7 @@ { __block DataTaskInfo * taskInfo = nil; dispatch_sync(self.taskInfoQueue, ^{ - taskInfo = self.taskInfoByTaskID[task]; + taskInfo = self.taskInfoByTaskID[@(task.taskIdentifier)]; }); return taskInfo; @@ -123,7 +130,7 @@ didCompleteWithError:(NSError *)error { DataTaskInfo * taskInfo = [self taskInfoForTask:task]; - [self.taskInfoByTaskID removeObjectForKey:@(taskInfo.task.taskIdentifier)]; + [self removeTaskInfoForTask:task]; if ([taskInfo.delegate respondsToSelector:@selector(URLSession:task:didCompleteWithError:)]) { |