summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-05-15 15:43:04 -0400
committerNicoleYarroch <nicole@livio.io>2019-05-15 15:43:04 -0400
commit3eb9881ab01ea72fe320fc1466840cabfe56f5a5 (patch)
treebc34e6dd01bd00eac0d23551c146586cdf9c3071
parente3d95d2064e8fc0f0b47381d0c228b39c525b3a2 (diff)
downloadsdl_ios-3eb9881ab01ea72fe320fc1466840cabfe56f5a5.tar.gz
Renamed stopSession to destroySession
-rw-r--r--SmartDeviceLink/SDLIAPControlSession.h2
-rw-r--r--SmartDeviceLink/SDLIAPControlSession.m14
-rw-r--r--SmartDeviceLink/SDLIAPDataSession.h2
-rw-r--r--SmartDeviceLink/SDLIAPDataSession.m12
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m16
-rw-r--r--SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPControlSessionSpec.m4
-rw-r--r--SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPDataSessionSpec.m4
7 files changed, 28 insertions, 26 deletions
diff --git a/SmartDeviceLink/SDLIAPControlSession.h b/SmartDeviceLink/SDLIAPControlSession.h
index ee94fbf20..1c836d0ce 100644
--- a/SmartDeviceLink/SDLIAPControlSession.h
+++ b/SmartDeviceLink/SDLIAPControlSession.h
@@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Stops the current control session if it is open.
*/
-- (void)stopSession;
+- (void)destroySession;
@end
diff --git a/SmartDeviceLink/SDLIAPControlSession.m b/SmartDeviceLink/SDLIAPControlSession.m
index d87369bec..3ff3802a9 100644
--- a/SmartDeviceLink/SDLIAPControlSession.m
+++ b/SmartDeviceLink/SDLIAPControlSession.m
@@ -65,7 +65,7 @@ int const ProtocolIndexTimeoutSeconds = 10;
if (![self.session start]) {
SDLLogW(@"Control session failed to setup with accessory: %@. Attempting to create a new control session", accessory);
- [self stopSession];
+ [self destroySession];
if (self.delegate == nil) { return; }
[self.delegate retryControlSession];
} else {
@@ -75,13 +75,13 @@ int const ProtocolIndexTimeoutSeconds = 10;
}
}
-- (void)stopSession {
+- (void)destroySession {
if (_session == nil) {
SDLLogV(@"Attempting to stop the control session but the session is nil");
return;
}
- SDLLogD(@"Stopping the control session");
+ SDLLogD(@"Destroying the control session");
[self.session stop];
self.session.streamDelegate = nil;
self.session = nil;
@@ -112,7 +112,7 @@ int const ProtocolIndexTimeoutSeconds = 10;
// End events come in pairs, only perform this once per set.
if (strongSelf.session != nil) {
[strongSelf.protocolIndexTimer cancel];
- [strongSelf stopSession];
+ [strongSelf destroySession];
if (strongSelf.delegate == nil) { return; }
[strongSelf.delegate retryControlSession];
@@ -147,7 +147,7 @@ int const ProtocolIndexTimeoutSeconds = 10;
// Destroy the control session as it is no longer needed, and then create the data session.
dispatch_sync(dispatch_get_main_queue(), ^{
- [strongSelf stopSession];
+ [strongSelf destroySession];
});
if (accessory.isConnected) {
@@ -174,7 +174,7 @@ int const ProtocolIndexTimeoutSeconds = 10;
SDLLogE(@"Control stream error");
[strongSelf.protocolIndexTimer cancel];
- [strongSelf stopSession];
+ [strongSelf destroySession];
if (self.delegate == nil) { return; }
[self.delegate retryControlSession];
@@ -253,7 +253,7 @@ int const ProtocolIndexTimeoutSeconds = 10;
- (void)dealloc {
SDLLogV(@"SDLIAPControlSession dealloc");
- _session = nil;
+ [self destroySession];
_protocolIndexTimer = nil;
}
diff --git a/SmartDeviceLink/SDLIAPDataSession.h b/SmartDeviceLink/SDLIAPDataSession.h
index 9eff35888..2de3f4341 100644
--- a/SmartDeviceLink/SDLIAPDataSession.h
+++ b/SmartDeviceLink/SDLIAPDataSession.h
@@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Stops a current session.
*/
-- (void)stopSession;
+- (void)destroySession;
@end
diff --git a/SmartDeviceLink/SDLIAPDataSession.m b/SmartDeviceLink/SDLIAPDataSession.m
index 8a53a18fd..e9e0ddfc4 100644
--- a/SmartDeviceLink/SDLIAPDataSession.m
+++ b/SmartDeviceLink/SDLIAPDataSession.m
@@ -58,20 +58,20 @@ NS_ASSUME_NONNULL_BEGIN
if (![self.session start]) {
SDLLogW(@"Data session failed to setup with accessory: %@. Retrying...", self.session.accessory);
- [self stopSession];
+ [self destroySession];
if (self.delegate == nil) { return; }
[self.delegate retryDataSession];
}
}
}
-- (void)stopSession {
+- (void)destroySession {
if (_session == nil) {
SDLLogV(@"Attempting to stop the data session but the session is nil");
return;
}
- SDLLogD(@"Stopping the data session");
+ SDLLogD(@"Destroying the data session");
[self.session stop];
self.session.streamDelegate = nil;
self.session = nil;
@@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
// The handler will be called on the IO thread, but the session stop method must be called on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
- [strongSelf stopSession];
+ [strongSelf destroySession];
if (self.delegate == nil) { return; }
[self.delegate retryDataSession];
@@ -155,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN
SDLLogE(@"Data stream error");
dispatch_async(dispatch_get_main_queue(), ^{
- [strongSelf stopSession];
+ [strongSelf destroySession];
if (![strongSelf.session.protocol isEqualToString:LegacyProtocolString]) {
if (self.delegate == nil) { return; }
[self.delegate retryDataSession];
@@ -211,7 +211,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)dealloc {
SDLLogV(@"SDLIAPDataSession dealloc");
- _session = nil;
+ [self destroySession];
}
@end
diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m
index 243dffe0d..5bab27bbb 100644
--- a/SmartDeviceLink/SDLIAPTransport.m
+++ b/SmartDeviceLink/SDLIAPTransport.m
@@ -211,8 +211,8 @@ int const CreateSessionRetries = 3;
- (void)sdl_closeSessions {
self.retryCounter = 0;
self.sessionSetupInProgress = NO;
- [self.controlSession stopSession];
- [self.dataSession stopSession];
+ [self.controlSession destroySession];
+ [self.dataSession destroySession];
}
/**
@@ -284,8 +284,8 @@ int const CreateSessionRetries = 3;
// Stop event listening here so that even if the transport is disconnected by the proxy we unregister for accessory local notifications
[self sdl_stopEventListening];
- [self.controlSession stopSession];
- [self.dataSession stopSession];
+ [self.controlSession destroySession];
+ [self.dataSession destroySession];
}
@@ -412,8 +412,8 @@ int const CreateSessionRetries = 3;
- (void)sdl_retryEstablishSession {
// Current strategy disallows automatic retries.
self.sessionSetupInProgress = NO;
- [self.controlSession stopSession];
- [self.dataSession stopSession];
+ [self.controlSession destroySession];
+ [self.dataSession destroySession];
// Search connected accessories
[self sdl_connect:nil];
@@ -440,6 +440,7 @@ int const CreateSessionRetries = 3;
* Called when the control session should be retried.
*/
- (void)retryControlSession {
+ SDLLogV(@"Retrying the control session");
[self sdl_retryEstablishSession];
}
@@ -459,6 +460,7 @@ int const CreateSessionRetries = 3;
* Called when the data session should be retried.
*/
- (void)retryDataSession {
+ SDLLogV(@"Retrying the data session");
[self sdl_retryEstablishSession];
}
@@ -565,7 +567,7 @@ int const CreateSessionRetries = 3;
#pragma mark - Lifecycle Destruction
- (void)dealloc {
- SDLLogV(@"SDLIAPTransport");
+ SDLLogV(@"SDLIAPTransport dealloc");
[self disconnect];
[self sdl_backgroundTaskEnd];
self.controlSession = nil;
diff --git a/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPControlSessionSpec.m b/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPControlSessionSpec.m
index 3590f3572..5a389b16c 100644
--- a/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPControlSessionSpec.m
+++ b/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPControlSessionSpec.m
@@ -159,7 +159,7 @@ describe(@"SDLIAPControlSession", ^{
beforeEach(^{
mockSession = nil;
controlSession = [[SDLIAPControlSession alloc] initWithSession:mockSession delegate:mockDelegate];
- [controlSession stopSession];
+ [controlSession destroySession];
});
it(@"Should not try to stop the session", ^{
@@ -171,7 +171,7 @@ describe(@"SDLIAPControlSession", ^{
context(@"That is started", ^{
beforeEach(^{
controlSession = [[SDLIAPControlSession alloc] initWithSession:mockSession delegate:mockDelegate];
- [controlSession stopSession];
+ [controlSession destroySession];
});
it(@"Should try to stop the session", ^{
diff --git a/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPDataSessionSpec.m b/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPDataSessionSpec.m
index 9dd4551b4..534457160 100644
--- a/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPDataSessionSpec.m
+++ b/SmartDeviceLinkTests/TransportSpecs/iAP/SDLIAPDataSessionSpec.m
@@ -141,7 +141,7 @@ describe(@"SDLIAPDataSession", ^{
context(@"That is nil", ^{
beforeEach(^{
dataSession = [[SDLIAPDataSession alloc] initWithSession:nil delegate:mockDelegate];
- [dataSession stopSession];
+ [dataSession destroySession];
});
it(@"Should not try to stop the session", ^{
@@ -152,7 +152,7 @@ describe(@"SDLIAPDataSession", ^{
context(@"That is started", ^{
beforeEach(^{
dataSession = [[SDLIAPDataSession alloc] initWithSession:mockSession delegate:mockDelegate];
- [dataSession stopSession];
+ [dataSession destroySession];
});
it(@"Should try to stop and detroy the session", ^{