summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-02-24 16:28:22 -0500
committerJoel Fischer <joeljfischer@gmail.com>2020-02-24 16:28:22 -0500
commitf9cddf22bad464448a89fb72b3143043bf8cd681 (patch)
treea58cc732eb8b34d88078dd3c21c8c1d2b0f89432
parentb4a95b476d00e7b67ee1598949d21b0cc0bad993 (diff)
downloadsdl_ios-f9cddf22bad464448a89fb72b3143043bf8cd681.tar.gz
Fixes #1564
* Ensure that all RPC requests are sent on the processing queue to ensure protected resources are accessed synchronously from the same queue
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m18
1 files changed, 12 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index 05a09dd9b..792755810 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -342,7 +342,7 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
// Send the request and depending on the response, post the notification
__weak typeof(self) weakSelf = self;
- [self sdl_sendRequest:regRequest
+ [self sendConnectionManagerRequest:regRequest
withResponseHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
// If the success BOOL is NO or we received an error at this point, we failed. Call the ready handler and transition to the DISCONNECTED state.
if (error != nil || ![response.success boolValue]) {
@@ -587,7 +587,7 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
SDLSetAppIcon *setAppIcon = [[SDLSetAppIcon alloc] init];
setAppIcon.syncFileName = appIcon.name;
- [self sdl_sendRequest:setAppIcon
+ [self sendConnectionManagerRequest:setAppIcon
withResponseHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
if (error != nil) {
SDLLogW(@"Error setting up app icon: %@", error);
@@ -651,7 +651,9 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
return;
}
- [self sdl_sendRequest:rpc withResponseHandler:nil];
+ [self sdl_runOnProcessingQueue:^{
+ [self sdl_sendRequest:rpc withResponseHandler:nil];
+ }];
}
- (void)sendConnectionRequest:(__kindof SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler {
@@ -676,13 +678,17 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
return;
}
-
- [self sdl_sendRequest:request withResponseHandler:handler];
+
+ [self sdl_runOnProcessingQueue:^{
+ [self sdl_sendRequest:request withResponseHandler:handler];
+ }];
}
// Managers need to avoid state checking. Part of <SDLConnectionManagerType>.
- (void)sendConnectionManagerRequest:(__kindof SDLRPCMessage *)request withResponseHandler:(nullable SDLResponseHandler)handler {
- [self sdl_sendRequest:request withResponseHandler:handler];
+ [self sdl_runOnProcessingQueue:^{
+ [self sdl_sendRequest:request withResponseHandler:handler];
+ }];
}
- (void)sdl_sendRequest:(__kindof SDLRPCMessage *)request withResponseHandler:(nullable SDLResponseHandler)handler {