From c4578976cdb3523af72841e110a9a42efd22950e Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Mon, 15 Apr 2019 15:23:53 -0400 Subject: Kill the proxy earlier * Ignore connections while we are attempting to shut down and reconnect --- SmartDeviceLink/SDLLifecycleManager.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 8cf5daa91..0c3b257ab 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -239,6 +239,8 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; - (void)sdl_stopManager:(BOOL)shouldRestart { SDLLogV(@"Stopping manager, %@", (shouldRestart ? @"will restart" : @"will not restart")); + self.proxy = nil; + [self.fileManager stop]; [self.permissionManager stop]; [self.lockScreenManager stop]; @@ -259,7 +261,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; self.hmiLevel = nil; self.audioStreamingState = nil; self.systemContext = nil; - self.proxy = nil; // Due to a race condition internally with EAStream, we cannot immediately attempt to restart the proxy, as we will randomly crash. // Apple Bug ID #30059457 @@ -277,6 +278,9 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } - (void)didEnterStateConnected { + // Ignore the connection while we are reconnecting. The proxy needs to be disposed and restarted in order to ensure correct state. https://github.com/smartdevicelink/sdl_ios/issues/1172 + if ([self.lifecycleState isEqualToString:SDLLifecycleStateReconnecting]) { return; } + // If we have security managers, add them to the proxy if (self.configuration.streamingMediaConfig.securityManagers != nil) { SDLLogD(@"Adding security managers"); -- cgit v1.2.1