Skip to content

Commit

Permalink
OLPHttpTask to lock toIgnoreResponse before usage
Browse files Browse the repository at this point in the history
It is 'synchronized' in the didCompleteWithError callback so it's better
to add 'synchronized' in the restarting as well

Relates-To: DATASDK-45
Signed-off-by: Rustam Gamidov <[email protected]>
  • Loading branch information
rustam-gamidov-here committed Oct 23, 2024
1 parent 60f7ef8 commit fff57fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ - (OLPHttpTaskStatus)restart {
}

if (_dataTask) {
_httpClient.toIgnoreResponse[_dataTask.taskDescription] = _dataTask;
@synchronized(_httpClient.toIgnoreResponse) {
_httpClient.toIgnoreResponse[_dataTask.taskDescription] = _dataTask;
}
[_dataTask cancel];
_dataTask = nil;
}
Expand Down

0 comments on commit fff57fd

Please sign in to comment.