diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 53f2059ac..314ec1c0f 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -262,6 +262,7 @@ - (void)didEnterStateReconnecting { - (void)sdl_stopManager:(BOOL)shouldRestart { SDLLogV(@"Stopping manager, %@", (shouldRestart ? @"will restart" : @"will not restart")); + [self.proxy disconnectSession]; self.proxy = nil; [self.fileManager stop]; diff --git a/SmartDeviceLink/SDLProxy.h b/SmartDeviceLink/SDLProxy.h index 60a68f44c..4fd20c4af 100644 --- a/SmartDeviceLink/SDLProxy.h +++ b/SmartDeviceLink/SDLProxy.h @@ -133,6 +133,9 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)putFileStream:(NSInputStream *)inputStream withRequest:(SDLPutFile *)putFileRPCRequest; +/// Disconnects the current app session, including the security manager and primary transport. +- (void)disconnectSession; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index d7d78fc83..a64e884c2 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -174,7 +174,8 @@ + (SDLProxy *)tcpProxyWithListener:(id)delegate tcpIPAddress:( return ret; } -- (void)dealloc { +- (void)disconnectSession { + SDLLogD(@"Disconnecting the proxy; stopping security manager and primary transport."); if (self.protocol.securityManager != nil) { [self.protocol.securityManager stop]; } @@ -186,6 +187,9 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [_urlSession invalidateAndCancel]; +} + +- (void)dealloc { SDLLogV(@"Proxy dealloc"); }